Removing a pane from a static splitter window
Simon Young -- young_simon@jpmorgan.com Wednesday, February 26, 1997 Environment: NT 3.51, VC++ 4.0 Can anyone help me with the best way to temporarily remove (programmatically) one of the panes in a static splitter window? There are normally two rows with just one column, and I want to hide the lower row from a toolbar button. Simon
Dong Chen -- d_chen@ix.netcom.com Wednesday, February 26, 1997 I saved a message posted here on last November by Rob den Breejen dealing with this. I haven't had a chance to try it, but it might be helpful to you. -- Dong d_chen@ix.netcom.com ---- saved message begins ---- Some handy Splitter functions can only be used for dynamic splitters. In these functions there's an ASSERT for SPLS_DYNAMIC_SPLIT. You can fake this by setting this style before calling a 'dynamic-style' function and restore afterwards. In the following code I wrote my own 'static' DeleteRow() and SplitRow(). void CSplitter::DeleteThisRow(int nRow) { // Get current style long lStyle = GetWindowLong(this->GetSafeHwnd(), GWL_STYLE); SetWindowLong(this->GetSafeHwnd(), GWL_STYLE, lStyle | SPLS_DYNAMIC_SPLIT); DeleteRow(nRow); // Restore style SetWindowLong(this->GetSafeHwnd(), GWL_STYLE, lStyle); } void CSplitter::SplitThisRow(int cyBefore) { long lStyle = GetWindowLong(this->GetSafeHwnd(), GWL_STYLE); SetWindowLong(this->GetSafeHwnd(), GWL_STYLE, lStyle | SPLS_DYNAMIC_SPLIT); m_pDynamicViewClass =3D RUNTIME_CLASS(CMyView); SetRowInfo(0, 100, 10); SplitRow(cyBefore); SetWindowLong(this->GetSafeHwnd(), GWL_STYLE, lStyle); } I hope this helps, Rob den Breejen. (robb@and.nl) ---- end of saved message ---- ---------- > From: Simon Young> To: mfc-l > Subject: Removing a pane from a static splitter window > Date: Wednesday, February 26, 1997 3:22 PM > > Environment: NT 3.51, VC++ 4.0 > > Can anyone help me with the best way to temporarily remove (programmatically) > one of the panes in a static splitter window? There are normally two rows with > just one column, and I want to hide the lower row from a toolbar button. > > Simon >
Regis NICOLAS -- regis.nicolas@smartcode.fr Thursday, February 27, 1997 [Mini-digest: 3 responses] At 05:22 PM 2/26/97 EDT, you wrote: >Environment: NT 3.51, VC++ 4.0 > >Can anyone help me with the best way to temporarily remove (programmatically) >one of the panes in a static splitter window? There are normally two rows with >just one column, and I want to hide the lower row from a toolbar button. > >Simon > > You may use SetRowInfo(?,0,0) to set the Ideal and Min Size to 0. Hope it helps... ------------------------------ Regis NICOLAS - R&D Windows Smartcode Technologie mailto:nicolas@smartcode.fr http://www.smartcode.fr/ http://www.smartcodesoft.com/ Tel.: (33) (0)4 67 59 30 16 -----From: Simon Young>From regis.nicolas@smartcode.fr >>At 05:22 PM 2/26/97 EDT, you wrote: >>Environment: NT 3.51, VC++ 4.0 >> >>Can anyone help me with the best way to temporarily remove (programmatically) >>one of the panes in a static splitter window? There are normally two rows with >>just one column, and I want to hide the lower row from a toolbar button. >> >>Simon >> >> >You may use SetRowInfo(?,0,0) to set the Ideal and Min Size to 0. >Hope it helps... This is what I am currently doing (plus SetRowInfo(0, max, 0)) but it doesn't really help :-( since the user can resize the other pane by using the splitter bar which appears at the bottom of the frame. I want to remove the pane completely so the user can't get at it at all. Simon -----From: Regis NICOLAS At 02:57 PM 2/27/97 EDT, you wrote: >>From regis.nicolas@smartcode.fr >>>At 05:22 PM 2/26/97 EDT, you wrote: >>>Environment: NT 3.51, VC++ 4.0 >>> >>>Can anyone help me with the best way to temporarily remove (programmatically) >>>one of the panes in a static splitter window? There are normally two rows >with >>>just one column, and I want to hide the lower row from a toolbar button. >>> >>>Simon >>> >>> >>You may use SetRowInfo(?,0,0) to set the Ideal and Min Size to 0. >>Hope it helps... > >This is what I am currently doing (plus SetRowInfo(0, max, 0)) but it doesn't >really help :-( >since the user can resize the other pane by using the splitter bar which >appears at the bottom >of the frame. I want to remove the pane completely so the user can't get at it >at all. > >Simon > > Unfortunately if you use a static splitter you will not be able to dynamically remove a pane. Regis ------------------------------ Regis NICOLAS - R&D Windows Smartcode Technologie mailto:nicolas@smartcode.fr http://www.smartcode.fr/ http://www.smartcodesoft.com/ Tel.: (33) (0)4 67 59 30 16
Arkady Elterman -- arkady@neca.com Thursday, February 27, 1997 [Mini-digest: 3 responses] I don't think you can "remove" a pane from a 2x1 splitter, because there is no such thing as a 1x1 splitter. You can, though, "re-parent" both views to the frame window (the splitter's parent), hide the lower view and destroy the splitter. Later you can re-create the splitter and re-parent the views back to it. It's a little more complex than just that (you need to resize views appropriately, assign correct window IDs, maybe play with windows' styles), but you got the idea. Arkady Elterman arkady@neca.com http://www.neca.com/~arkady/spin.htm ---------- : From: Simon Young: To: mfc-l : Subject: Removing a pane from a static splitter window : Date: Wednesday, February 26, 1997 4:22 PM : : Environment: NT 3.51, VC++ 4.0 : : Can anyone help me with the best way to temporarily remove (programmatically) : one of the panes in a static splitter window? There are normally two rows with : just one column, and I want to hide the lower row from a toolbar button. : : Simon : -----From: "Dorie Hannan" You can do this. The best place to see what you can do is in Dr. Dobbs December and January issues. Scot Wingo takes a look inside CSplitterWnd to show all kinds of neat stuff. What you need to do is create your own Splitter Window class. Mine for instance is CBrowseSplitter. Then I have my own methods called HideSynColumn and ShowSynColumn. Inside of these you change the values for m_nCols or m_nRows(whichever you want to change). void CBrowseSplitter::HideSynColumn() { m_nCols = 1; RecalcLayout(); } void CBrowseSplitter::ShowSynColumn() { m_nCols = 2; m_pSynPane->SetDlgCtrlID(IdFromRowCol(0,1)); RecalcLayout(); } void CBrowseSplitter::SetSynPane() { m_pSynPane = GetDlgItem(IdFromRowCol(0,1)); } So I do this from a button by calling HideSynColumn() or ShowSynColumn(). Believe it or not its really that simple. Hope that helps! > Environment: NT 3.51, VC++ 4.0 > > Can anyone help me with the best way to temporarily remove (programmatically) > one of the panes in a static splitter window? There are normally two rows with > just one column, and I want to hide the lower row from a toolbar button. > > Simon > > -----From: Simon Young Thanks for this: this is exactly what I wanted. Since it appears to be this simple to 'hack' the functionality in to a static splitter, it seems as if the ASSERT style = dynamic could be removed from the MFC code for the DeleteRow and SplitRow calls (together with associated other minor changes) - Mike B? Simon To: mfc-l @ netcom.com @ SMTP cc: From: d_chen @ ix.netcom.com ("Dong Chen") @ SMTP Sent: Wed 02/26/97 09:22:00 PM EST Subject: Re: Removing a pane from a static splitter window I saved a message posted here on last November by Rob den Breejen dealing with this. I haven't had a chance to try it, but it might be helpful to you. -- Dong d_chen@ix.netcom.com ---- saved message begins ---- Some handy Splitter functions can only be used for dynamic splitters. In these functions there's an ASSERT for SPLS_DYNAMIC_SPLIT. You can fake this by setting this style before calling a 'dynamic-style' function and restore afterwards. In the following code I wrote my own 'static' DeleteRow() and SplitRow(). void CSplitter::DeleteThisRow(int nRow) { // Get current style long lStyle = GetWindowLong(this->GetSafeHwnd(), GWL_STYLE); SetWindowLong(this->GetSafeHwnd(), GWL_STYLE, lStyle | SPLS_DYNAMIC_SPLIT); DeleteRow(nRow); // Restore style SetWindowLong(this->GetSafeHwnd(), GWL_STYLE, lStyle); } void CSplitter::SplitThisRow(int cyBefore) { long lStyle = GetWindowLong(this->GetSafeHwnd(), GWL_STYLE); SetWindowLong(this->GetSafeHwnd(), GWL_STYLE, lStyle | SPLS_DYNAMIC_SPLIT); m_pDynamicViewClass =3D RUNTIME_CLASS(CMyView); SetRowInfo(0, 100, 10); SplitRow(cyBefore); SetWindowLong(this->GetSafeHwnd(), GWL_STYLE, lStyle); } I hope this helps, Rob den Breejen. (robb@and.nl) ---- end of saved message ---- ---------- > From: Simon Young > To: mfc-l > Subject: Removing a pane from a static splitter window > Date: Wednesday, February 26, 1997 3:22 PM > > Environment: NT 3.51, VC++ 4.0 > > Can anyone help me with the best way to temporarily remove (programmatically) > one of the panes in a static splitter window? There are normally two rows with > just one column, and I want to hide the lower row from a toolbar button. > > Simon >
Become an MFC-L member | Вернуться в корень Архива |