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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Splitter "OnSize strikes back..." !

Splitter "OnSize strikes back..." !

Scheduled Pinned Locked Moved C / C++ / MFC
help
4 Posts 2 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.
  • C Offline
    C Offline
    CrocodileBuck
    wrote on last edited by
    #1

    Hi, i have a Sdi with a splitter (4 rows). When i click on the maximize button the window is maximized and the 1. splitter row changes its height proportionally , but when i try to restore, nothing happens with the Splitter ;(. Please help me ! Here is my code:

    /************************************************************************/
    /* Resizen des Splitters */
    /************************************************************************/
    void CMainFrame::OnSize(UINT nType, int cx, int cy)
    {

    int			iCurRow\_cy		= 0, iMin\_cy	= 0;
    static int  iOldWnd\_cy		= 0, iOldWnd\_cx = 0;
    int			iNewCurRow\_cy	= 0;
    static int	iZaehler		= 0;
    
    static CString a, b, c, d;
    
    iZaehler++;
    if (iZaehler == 1)
    {
    	iOldWnd\_cy = cy;
    
    	a.Format("%02d",iOldWnd\_cy);
    	b.Format("%02d",cy);
    	c.Format("%02d",iCurRow\_cy);
    	d.Format("%02d",iNewCurRow\_cy);
    	MessageBox("iOldWnd\_cy: "+ a + "\\ncy:                " + b + "\\niCurRow\_cy: " + c + "\\niNewCurRow\_cy:   " + d,"in: iZaehler == 1 " ,MB\_OK);
    }
    
    
    if ((nType == SIZE\_MAXIMIZED))
    {   
    
    	m\_Splitter\_Main.GetRowInfo(0 ,iCurRow\_cy, iMin\_cy);
    	iNewCurRow\_cy =	(int)ResizeSplitter(cx, cy, iOldWnd\_cx, iOldWnd\_cy, iCurRow\_cy, 1);
    
    	a.Format("%02d",iOldWnd\_cy);
    	b.Format("%02d",cy);
    	c.Format("%02d",iCurRow\_cy);
    	d.Format("%02d",iNewCurRow\_cy);
    	MessageBox("iOldWnd\_cy: "+ a + "\\ncy:                " + b + "\\niCurRow\_cy: " + c + "\\niNewCurRow\_cy:   " + d,"in: SIZE\_MAXIMIZED " ,MB\_OK);
    
     	m\_Splitter\_Main.SetRowInfo(0, iNewCurRow\_cy , 0);
    // 	m\_Splitter\_Main.SetRowInfo(1, spRect.Height()/4, 0);
    // 	m\_Splitter\_Main.SetRowInfo(2, spRect.Height()/4, 0);
    // 	m\_Splitter\_Main.SetRowInfo(3, spRect.Height()/4, 0);
    
    	m\_Splitter\_Main.RecalcLayout();	
    
    }
    else if((!m\_Splitter\_Main.m\_hWnd && nType == SIZE\_RESTORED))
    {
    	m\_Splitter\_Main.GetRowInfo(0 ,iCurRow\_cy, iMin\_cy);
    	iNewCurRow\_cy =	(int)ResizeSplitter(cx, cy, iOldWnd\_cx, iOldWnd\_cy, iCurRow\_cy, (1));
    	
    	a.Format("%02d",iOldWnd\_cy);
    	b.Format("%02d",cy);
    	c.Format("%02d",iCurRow\_cy);
    	d.Format("%02d",iNewCurRow\_cy);
    	MessageBox("iOldWnd\_cy: "+ a + "\\ncy:                " + b + "\\niCurRow\_cy: " + c + "\\niNewCurRow\_cy:   " + d,"in: SIZE\_RESTORED " ,MB\_OK);
    
     	m\_Splitter\_Main.SetRowInfo(0, iNewCurRow\_cy , 0);
    	m\_Splitter\_Main.RecalcLayout();	
    }
    

    CFrameWnd::OnSize(nType, cx, cy);

    }

    double CMainFrame::ResizeSplitter(int cx, int cy, int iOldWnd_cx, int iOldWnd_cy, int iCurRow_cy, int iZahl)
    {
    doubl

    C 1 Reply Last reply
    0
    • C CrocodileBuck

      Hi, i have a Sdi with a splitter (4 rows). When i click on the maximize button the window is maximized and the 1. splitter row changes its height proportionally , but when i try to restore, nothing happens with the Splitter ;(. Please help me ! Here is my code:

      /************************************************************************/
      /* Resizen des Splitters */
      /************************************************************************/
      void CMainFrame::OnSize(UINT nType, int cx, int cy)
      {

      int			iCurRow\_cy		= 0, iMin\_cy	= 0;
      static int  iOldWnd\_cy		= 0, iOldWnd\_cx = 0;
      int			iNewCurRow\_cy	= 0;
      static int	iZaehler		= 0;
      
      static CString a, b, c, d;
      
      iZaehler++;
      if (iZaehler == 1)
      {
      	iOldWnd\_cy = cy;
      
      	a.Format("%02d",iOldWnd\_cy);
      	b.Format("%02d",cy);
      	c.Format("%02d",iCurRow\_cy);
      	d.Format("%02d",iNewCurRow\_cy);
      	MessageBox("iOldWnd\_cy: "+ a + "\\ncy:                " + b + "\\niCurRow\_cy: " + c + "\\niNewCurRow\_cy:   " + d,"in: iZaehler == 1 " ,MB\_OK);
      }
      
      
      if ((nType == SIZE\_MAXIMIZED))
      {   
      
      	m\_Splitter\_Main.GetRowInfo(0 ,iCurRow\_cy, iMin\_cy);
      	iNewCurRow\_cy =	(int)ResizeSplitter(cx, cy, iOldWnd\_cx, iOldWnd\_cy, iCurRow\_cy, 1);
      
      	a.Format("%02d",iOldWnd\_cy);
      	b.Format("%02d",cy);
      	c.Format("%02d",iCurRow\_cy);
      	d.Format("%02d",iNewCurRow\_cy);
      	MessageBox("iOldWnd\_cy: "+ a + "\\ncy:                " + b + "\\niCurRow\_cy: " + c + "\\niNewCurRow\_cy:   " + d,"in: SIZE\_MAXIMIZED " ,MB\_OK);
      
       	m\_Splitter\_Main.SetRowInfo(0, iNewCurRow\_cy , 0);
      // 	m\_Splitter\_Main.SetRowInfo(1, spRect.Height()/4, 0);
      // 	m\_Splitter\_Main.SetRowInfo(2, spRect.Height()/4, 0);
      // 	m\_Splitter\_Main.SetRowInfo(3, spRect.Height()/4, 0);
      
      	m\_Splitter\_Main.RecalcLayout();	
      
      }
      else if((!m\_Splitter\_Main.m\_hWnd && nType == SIZE\_RESTORED))
      {
      	m\_Splitter\_Main.GetRowInfo(0 ,iCurRow\_cy, iMin\_cy);
      	iNewCurRow\_cy =	(int)ResizeSplitter(cx, cy, iOldWnd\_cx, iOldWnd\_cy, iCurRow\_cy, (1));
      	
      	a.Format("%02d",iOldWnd\_cy);
      	b.Format("%02d",cy);
      	c.Format("%02d",iCurRow\_cy);
      	d.Format("%02d",iNewCurRow\_cy);
      	MessageBox("iOldWnd\_cy: "+ a + "\\ncy:                " + b + "\\niCurRow\_cy: " + c + "\\niNewCurRow\_cy:   " + d,"in: SIZE\_RESTORED " ,MB\_OK);
      
       	m\_Splitter\_Main.SetRowInfo(0, iNewCurRow\_cy , 0);
      	m\_Splitter\_Main.RecalcLayout();	
      }
      

      CFrameWnd::OnSize(nType, cx, cy);

      }

      double CMainFrame::ResizeSplitter(int cx, int cy, int iOldWnd_cx, int iOldWnd_cy, int iCurRow_cy, int iZahl)
      {
      doubl

      C Offline
      C Offline
      CrocodileBuck
      wrote on last edited by
      #2

      REALLY NOBODY !!!??? Best regards Croc

      enhzflepE 1 Reply Last reply
      0
      • C CrocodileBuck

        REALLY NOBODY !!!??? Best regards Croc

        enhzflepE Offline
        enhzflepE Offline
        enhzflep
        wrote on last edited by
        #3

        Have you tried handling WM_WINDOWPOSCHANGED? This is called whenever you minimize, maximize, restore or move. I reckon you'll get away with making the code in your onSize handler respond to WM_WINDOWPOSCHANGED instead of WM_SIZE.

        modified on Sunday, October 12, 2008 8:44 AM

        C 1 Reply Last reply
        0
        • enhzflepE enhzflep

          Have you tried handling WM_WINDOWPOSCHANGED? This is called whenever you minimize, maximize, restore or move. I reckon you'll get away with making the code in your onSize handler respond to WM_WINDOWPOSCHANGED instead of WM_SIZE.

          modified on Sunday, October 12, 2008 8:44 AM

          C Offline
          C Offline
          CrocodileBuck
          wrote on last edited by
          #4

          THX enhzflep, i'll try it !!! Best regards ShadowEater

          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