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. splitterWnd in SDI MFC

splitterWnd in SDI MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
6 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.
  • G Offline
    G Offline
    gurucplusplus
    wrote on last edited by
    #1

    splitterWnd in SDI MFC 1hr 11mins ago I create a SDI application in MFC wizard with splitter option. I modified OnCreateClient function to create static splitter into two rows and one column, and further split top row to one row and two columns. The code is simple as below: CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { mainSplitterWnd.CreateStatic(this, 2, 1) ; //then the childSplitterWnd of the mainSplitterWnd to CreateStatic(1,2, WS_CHILD | WS_VISIBLE, mainSplitterWnd.IdFromRowCol(0,0)); //then assign both childSplitterWnd to views childSplitterWnd.CreateView(0,0,RUNTIME_CLASS(CMyChildLeftView),CSize(500,500),pContext); childSplitterWnd.CreateView(0,1,RUNTIME_CLASS(CMyChildRighView),CSize(100,100),pContext); //then assign bottom main frame of mainSplitterWnd mainSplitterWnd.CreateView(1,0,RUNTIME_CLASS(CMyBottomView),CSize(300,300),pContext); return TRUE; } When I execute the code I only see the middle splitter bar display on the very top of the main frame, then I have do use the mouse to drag splitter bar down. I don't understand why I have to do that if I create static splitter. Help!!!!

    N J 2 Replies Last reply
    0
    • G gurucplusplus

      splitterWnd in SDI MFC 1hr 11mins ago I create a SDI application in MFC wizard with splitter option. I modified OnCreateClient function to create static splitter into two rows and one column, and further split top row to one row and two columns. The code is simple as below: CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { mainSplitterWnd.CreateStatic(this, 2, 1) ; //then the childSplitterWnd of the mainSplitterWnd to CreateStatic(1,2, WS_CHILD | WS_VISIBLE, mainSplitterWnd.IdFromRowCol(0,0)); //then assign both childSplitterWnd to views childSplitterWnd.CreateView(0,0,RUNTIME_CLASS(CMyChildLeftView),CSize(500,500),pContext); childSplitterWnd.CreateView(0,1,RUNTIME_CLASS(CMyChildRighView),CSize(100,100),pContext); //then assign bottom main frame of mainSplitterWnd mainSplitterWnd.CreateView(1,0,RUNTIME_CLASS(CMyBottomView),CSize(300,300),pContext); return TRUE; } When I execute the code I only see the middle splitter bar display on the very top of the main frame, then I have do use the mouse to drag splitter bar down. I don't understand why I have to do that if I create static splitter. Help!!!!

      N Offline
      N Offline
      Nelek
      wrote on last edited by
      #2

      Which MapMode are you using?

      Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

      G 1 Reply Last reply
      0
      • G gurucplusplus

        splitterWnd in SDI MFC 1hr 11mins ago I create a SDI application in MFC wizard with splitter option. I modified OnCreateClient function to create static splitter into two rows and one column, and further split top row to one row and two columns. The code is simple as below: CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { mainSplitterWnd.CreateStatic(this, 2, 1) ; //then the childSplitterWnd of the mainSplitterWnd to CreateStatic(1,2, WS_CHILD | WS_VISIBLE, mainSplitterWnd.IdFromRowCol(0,0)); //then assign both childSplitterWnd to views childSplitterWnd.CreateView(0,0,RUNTIME_CLASS(CMyChildLeftView),CSize(500,500),pContext); childSplitterWnd.CreateView(0,1,RUNTIME_CLASS(CMyChildRighView),CSize(100,100),pContext); //then assign bottom main frame of mainSplitterWnd mainSplitterWnd.CreateView(1,0,RUNTIME_CLASS(CMyBottomView),CSize(300,300),pContext); return TRUE; } When I execute the code I only see the middle splitter bar display on the very top of the main frame, then I have do use the mouse to drag splitter bar down. I don't understand why I have to do that if I create static splitter. Help!!!!

        J Offline
        J Offline
        jhwurmbach
        wrote on last edited by
        #3

        gurucplusplus wrote:

        I don't understand why I have to do that if I create static splitter.

        I dont know either, why CreateStatic or CreateView do not work. But you can call SetColumnInfo() and SetRowInfo() on the splitters to set the ideal and the minimal size. RecalcLayout() afterwards.


        Failure is not an option - it's built right in.

        G 1 Reply Last reply
        0
        • N Nelek

          Which MapMode are you using?

          Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

          G Offline
          G Offline
          gurucplusplus
          wrote on last edited by
          #4

          I use default map mode MM_TEXT. One thing I find out is that if you // one row and two column then m_mainSplitterFrame.Createstatic(1,2) // then further split second column in two row m_childSplitterFrame.CreateStatic(&m_mainSplitterFrame,1,2,RUNTIME_CLASS(CMyView),CSize(500,500),m_mainSplitterFrame.IDFromColRow(0,1)); This code works as long as you don't split the first pane of the m_mainSplitter.

          1 Reply Last reply
          0
          • J jhwurmbach

            gurucplusplus wrote:

            I don't understand why I have to do that if I create static splitter.

            I dont know either, why CreateStatic or CreateView do not work. But you can call SetColumnInfo() and SetRowInfo() on the splitters to set the ideal and the minimal size. RecalcLayout() afterwards.


            Failure is not an option - it's built right in.

            G Offline
            G Offline
            gurucplusplus
            wrote on last edited by
            #5

            Is it true that m_childSplitterFrame.CreateView(0,0,RUNTIME_CLASS(CMyView),CSize(100,100),pContext) means create the view with minimum size of CSize()?

            J 1 Reply Last reply
            0
            • G gurucplusplus

              Is it true that m_childSplitterFrame.CreateView(0,0,RUNTIME_CLASS(CMyView),CSize(100,100),pContext) means create the view with minimum size of CSize()?

              J Offline
              J Offline
              jhwurmbach
              wrote on last edited by
              #6

              Yes, this is how it is documented. But for me it somehow does not work. So I use SetColumnInfo() and SetRowInfo() the first time OnSize() is called.


              Failure is not an option - it's built right in.

              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