Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Doubt in Splitter window

Doubt in Splitter window

Scheduled Pinned Locked Moved C / C++ / MFC
data-structures
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 3037427
    wrote on last edited by
    #1

    I have created a splitter window inside another splitter window. In the newly created splitter window pane, a tree control is placed. Upon selecting an item in the tree control, i want third splitter window to get created. But i am not able to get it done. Before selecting the item: first pane --------------------------- tree| ctrl| second pane pane| After selecting the tree item: first pane ----------------------------- tree | I-II pane ctrl |-------------------- pane | II-II pane Any body plz give me an idea.:sigh: Thanks in advance.:)

    R S 2 Replies Last reply
    0
    • U User 3037427

      I have created a splitter window inside another splitter window. In the newly created splitter window pane, a tree control is placed. Upon selecting an item in the tree control, i want third splitter window to get created. But i am not able to get it done. Before selecting the item: first pane --------------------------- tree| ctrl| second pane pane| After selecting the tree item: first pane ----------------------------- tree | I-II pane ctrl |-------------------- pane | II-II pane Any body plz give me an idea.:sigh: Thanks in advance.:)

      R Offline
      R Offline
      raghuji rao
      wrote on last edited by
      #2

      u cannot create a third splitter window by selecting an treectrl item bcoz this splitter window will initialize in oncreateclient and it will call only once.

      1 Reply Last reply
      0
      • U User 3037427

        I have created a splitter window inside another splitter window. In the newly created splitter window pane, a tree control is placed. Upon selecting an item in the tree control, i want third splitter window to get created. But i am not able to get it done. Before selecting the item: first pane --------------------------- tree| ctrl| second pane pane| After selecting the tree item: first pane ----------------------------- tree | I-II pane ctrl |-------------------- pane | II-II pane Any body plz give me an idea.:sigh: Thanks in advance.:)

        S Offline
        S Offline
        Sameer_Thakur
        wrote on last edited by
        #3

        U cannot create a third splitter window by selecting an treectrl item bcoz this splitter window will initialize in oncreateclient and it will call only once. What u can do is create this third window in the oncreateclient only but set its width to 1( you cannot set the width to 0 in MFC) and when you select the tree control once again set the width of third window to desired size. To set the width you can use SetRowInfo() and SetColInfo()(please refer MSDN for more help about SetRowInfo() and SetColInfo()) Rakesh -- modified at 5:53 Saturday 3rd June, 2006

        U 1 Reply Last reply
        0
        • S Sameer_Thakur

          U cannot create a third splitter window by selecting an treectrl item bcoz this splitter window will initialize in oncreateclient and it will call only once. What u can do is create this third window in the oncreateclient only but set its width to 1( you cannot set the width to 0 in MFC) and when you select the tree control once again set the width of third window to desired size. To set the width you can use SetRowInfo() and SetColInfo()(please refer MSDN for more help about SetRowInfo() and SetColInfo()) Rakesh -- modified at 5:53 Saturday 3rd June, 2006

          U Offline
          U Offline
          User 3037427
          wrote on last edited by
          #4

          I getting an exception. This is what i did in my code: CMainFrame::OnCreateClient(..) { m_wndSplitter.CreateStatic( this,1,2); m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CMyTree),CSize(200,100),pContext); m_wndSplitter1.CreateStatic(&m_wndSplitter,1,2,WS_CHILD | WS_VISIBLE | WS_BORDER,m_wndSplitter.IdFromRowCol(0,1)); m_wndSplitter1.CreateView(0,0,RUNTIME_CLASS(CMyView1),CSize(200,100),pContext); m_wndSplitter1.CreateView(0,1,RUNTIME_CLASS(CMyView1),CSize(400,200),pContext); m_wndSplitter2.CreateStatic(&m_wndSplitter1,1,2,WS_CHILD | WS_VISIBLE | WS_BORDER,m_wndSplitter.IdFromRowCol(0,1)); m_wndSplitter2.SetRowInfo(0,1,1); m_wndSplitter2.SetColumnInfo(0,1,1); m_wndSplitter2.SetColumnInfo(1,1,1); pCon=*pContext; ..... } In tree control view: void CMyTree::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) { NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; CMultiSplitWndApp* app=(CMultiSplitWndApp*)AfxGetApp(); HTREEITEM sel=pNMTreeView->itemNew.hItem; CString str= GetTreeCtrl().GetItemText(sel); CMainFrame* wnd=(CMainFrame*)app->m_pMainWnd; wnd->m_wndSplitter1.DeleteView(0,1); wnd->m_wndSplitter2.SetColumnInfo(0,400,100); wnd->m_wndSplitter2.SetColumnInfo(1,400,100); wnd->m_wndSplitter2.SetRowInfo(0,400,100); wnd->m_wndSplitter2.CreateView(0,1,RUNTIME_CLASSCMyTree),CSize (400,200),&wnd->pCon); wnd->m_wndSplitter2.CreateView(0,1,RUNTIME_CLASS(CMyTree),CSize(400,200),&wnd->pCon); *pResult = 0; } Correct me if there is any wrong. Thanks for ur reply.:)

          S 1 Reply Last reply
          0
          • U User 3037427

            I getting an exception. This is what i did in my code: CMainFrame::OnCreateClient(..) { m_wndSplitter.CreateStatic( this,1,2); m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CMyTree),CSize(200,100),pContext); m_wndSplitter1.CreateStatic(&m_wndSplitter,1,2,WS_CHILD | WS_VISIBLE | WS_BORDER,m_wndSplitter.IdFromRowCol(0,1)); m_wndSplitter1.CreateView(0,0,RUNTIME_CLASS(CMyView1),CSize(200,100),pContext); m_wndSplitter1.CreateView(0,1,RUNTIME_CLASS(CMyView1),CSize(400,200),pContext); m_wndSplitter2.CreateStatic(&m_wndSplitter1,1,2,WS_CHILD | WS_VISIBLE | WS_BORDER,m_wndSplitter.IdFromRowCol(0,1)); m_wndSplitter2.SetRowInfo(0,1,1); m_wndSplitter2.SetColumnInfo(0,1,1); m_wndSplitter2.SetColumnInfo(1,1,1); pCon=*pContext; ..... } In tree control view: void CMyTree::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) { NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; CMultiSplitWndApp* app=(CMultiSplitWndApp*)AfxGetApp(); HTREEITEM sel=pNMTreeView->itemNew.hItem; CString str= GetTreeCtrl().GetItemText(sel); CMainFrame* wnd=(CMainFrame*)app->m_pMainWnd; wnd->m_wndSplitter1.DeleteView(0,1); wnd->m_wndSplitter2.SetColumnInfo(0,400,100); wnd->m_wndSplitter2.SetColumnInfo(1,400,100); wnd->m_wndSplitter2.SetRowInfo(0,400,100); wnd->m_wndSplitter2.CreateView(0,1,RUNTIME_CLASSCMyTree),CSize (400,200),&wnd->pCon); wnd->m_wndSplitter2.CreateView(0,1,RUNTIME_CLASS(CMyTree),CSize(400,200),&wnd->pCon); *pResult = 0; } Correct me if there is any wrong. Thanks for ur reply.:)

            S Offline
            S Offline
            Sameer_Thakur
            wrote on last edited by
            #5

            Hi I think the reason why u r getting an exception is that void CMyTree::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) { .......... ............. wnd->m_wndSplitter1.DeleteView(0,1); ....... ....... } you have splitted the m_wndSplitter1 view into 1 row 2 col. Now while deleting you are writing wnd->m_wndSplitter1.DeleteView(0,1); which delets view assigned to one window only and second window is still having the view with it. So when you try to assign the view to this window you get an exception. Insted you try wnd->m_wndSplitter2.DeleteView(0,0); wnd->m_wndSplitter2.DeleteView(0,1); and then try to reassign the views. Rakesh

            U 1 Reply Last reply
            0
            • S Sameer_Thakur

              Hi I think the reason why u r getting an exception is that void CMyTree::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) { .......... ............. wnd->m_wndSplitter1.DeleteView(0,1); ....... ....... } you have splitted the m_wndSplitter1 view into 1 row 2 col. Now while deleting you are writing wnd->m_wndSplitter1.DeleteView(0,1); which delets view assigned to one window only and second window is still having the view with it. So when you try to assign the view to this window you get an exception. Insted you try wnd->m_wndSplitter2.DeleteView(0,0); wnd->m_wndSplitter2.DeleteView(0,1); and then try to reassign the views. Rakesh

              U Offline
              U Offline
              User 3037427
              wrote on last edited by
              #6

              Thanks for ur reply. But still i am gettinmg an exception. :((

              S 1 Reply Last reply
              0
              • U User 3037427

                Thanks for ur reply. But still i am gettinmg an exception. :((

                S Offline
                S Offline
                Sameer_Thakur
                wrote on last edited by
                #7

                Sorry then,thats all from my side... Will update you if I find any help on this issue... Rakesh

                U 1 Reply Last reply
                0
                • S Sameer_Thakur

                  Sorry then,thats all from my side... Will update you if I find any help on this issue... Rakesh

                  U Offline
                  U Offline
                  User 3037427
                  wrote on last edited by
                  #8

                  Thankyou.:)

                  S 1 Reply Last reply
                  0
                  • U User 3037427

                    Thankyou.:)

                    S Offline
                    S Offline
                    Sameer_Thakur
                    wrote on last edited by
                    #9

                    Hello, I found some interesting facts about CSplitterWnd::CreateView(). The document says that you cannot call the 'CreateView()' from outside the OnCreateClient(). But you can call it indirectly from OnCreateClient() i.e. you can call another function from OnCreateClient() which calls CreateView(). ________________________________________________________ For example.... OnCreateClient(..) { CreateAllViews(..) } CreateAllViews(..) { CreateView(...); CreateView(...); } ______________________________________________ In your code you are calling CreatView() in void CMyTree::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult). I think this might be the reason why you get an exception..... Rakesh

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups