15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


A questioin on splitting frame

Dennis W. Tan -- dennis@ny.amarex.com
Thursday, October 31, 1996

Environment: VC++ 4.2-flat, Win 95

	In one of my recent projects, I have created a two way static splitting 
frame. Is there a way to close or reopen one of panes just by clicking a menu item ? Any help would be appreciated.

Dennis W. Tan
Software Engineer




Robert Somrek -- Robert.Somrek@noaa.gov
Sunday, November 03, 1996

[Mini-digest: 2 responses]


     Dennis,
     
     I have two views and allow the user to split them from the View menu 
     or toolbar (all options are mapped to this code -- whole map view, 
     whole edit view, 50/50 split) with the following code:
     
     void CMyMDIFrame::OnViewView(UINT nID)
     {
        CRect rcClient;
     
        if (nID == ID_VIEW_MAP)
                ActivateView(RUNTIME_CLASS(CMyMapView));
        else if (nID == ID_VIEW_EDITOR)
                ActivateView(RUNTIME_CLASS(CMyEditView));
        CMyMDIChild* pMDIChildWnd = (CMyMDIChild*)MDIGetActive();
        CSplitterWnd* pSplitterWnd = pMDIChildWnd->GetSplitterWnd();
        pSplitterWnd->GetClientRect(rcClient);
        pSplitterWnd->SetColumnInfo(nID == ID_VIEW_MAP ? 0 : 1, nID         
         != ID_VIEW_SPLIT ? rcClient.right : rcClient.right / 2, 1);
        pSplitterWnd->SetColumnInfo(nID == ID_VIEW_MAP ? 1 : 0, nID         
         != ID_VIEW_SPLIT ? 1 : rcClient.right / 2, 1);
        pSplitterWnd->RecalcLayout();
     }
     
     This code leaves the splitter bar "parked" along the side of the view; 
     the view is not completely hidden.
     
     Bob Somrek
     
     


______________________________ Reply Separator _________________________________
Subject: A questioin on splitting frame
Author:  dennis@ny.amarex.com at EXTERNAL
Date:    11/2/96 3:05 AM


Environment: VC++ 4.2-flat, Win 95
     
     In one of my recent projects, I have created a two way static splitting
frame. Is there a way to close or reopen one of panes just by clicking a menu
 item ? Any help would be appreciated.
     
Dennis W. Tan
Software Engineer
-----From: "Doug Brubacher" 

     Dennis,
     
     Try using 
        CSplitterWnd::SetColumnInfo( int col, int cxIdeal, int cxMin )
     by setting the cxMin value > then the current size and the cxIdeal 
     size you can indicate that the pane can not be displayed because there 
     is not enough room (by making cxMin > the screen size you can ensure 
     the user can never resize the splitter window to see the pane).  
     Conversely set cxMin <= cxIdeal to redisplay the pane.
     
     In both cases call CSplitterWnd::RecalcLayout() after you call to 
     SetColumnInfo().
     
     Note the following from the MFC documentation:
     "void RecalcLayout( );
       
     Remarks
     Call this member function to correctly redisplay the splitter window 
     after you have adjusted row and column sizes with the SetRowInfo and 
     SetColumnInfo member functions. If you change row and column sizes as 
     part of the creation process before the splitter window is visible, it 
     is not necessary to call this member function.
     The framework calls this member function whenever the user resizes the 
     splitter window or moves a split."
     
     Regards
     
     Doug Brubacher
     DouglasB@msn.com





| Вернуться в корень Архива |