Disallow resize of CSplitterWnd
Asaf Kashi -- kashi@sr.hp.com Sunday, March 09, 1997 Environment: NT 4.0, VC 4.2b, VC 5.0 I have a CSplitterWnd in my mainframe. It has two views and I want the whole setup to stay the same size. Which message do I need to intercept to prevent the user from being able to use the splitterbar between my panes to resize them and where should I catch it, or is there an easier way? Thanks, Asaf --- Asaf Kashi Software Development Engineer Hewlett Packard - Santa Rosa Systems Division kashi@ap.net http://www.ap.net/~kashi kashi@sr.hp.com hp: http://styx.sr.hp.com/kashi
Syed -- sxs296@psu.edu Wednesday, March 12, 1997 [Mini-digest: 4 responses] At 04:53 PM 3/9/97 -0800, you wrote: >Environment: NT 4.0, VC 4.2b, VC 5.0 > >I have a CSplitterWnd in my mainframe. It has two views and I want the >whole setup to stay the same size. >Which message do I need to intercept to prevent the user from being able >to use the splitterbar between my panes to resize them and where should >I catch it, or is there an easier way? > Gosh.. I just did that. It's is not difficult actually to do that once you understand the CSplitterWnd's implementation. First of all, derive a new class from CSplitterWnd. Add your own WM_SETCURSOR, WM_LBUTTONDOWN & WM_MOUSEMOVE. In all of the event handler above, merely call CWnd::OnXXXXX where XXXX is the appropriate base member function. eg CMySplitterWnd::OnSetCursor(...) { CWnd::OnSetCursor(); } that's it. you are set. I believe this is the easiest yet the most efficient method. -----From: "Cunningham Graham, GD-IT347"Hi, I am sure there is a knowledge base or example somewhere that shows this but what I do is to override the following 3 functions in my CspliterWnd derived class // The next three handlers will prevent the user from moving the // scrollbars. void CSplitter::OnLButtonDown(UINT nFlags, CPoint point) { // prevent the user from dragging the splitter bar //rmoved for the first version //return; CSplitterWnd::OnLButtonDown(nFlags, point); } BOOL CSplitter::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { return CSplitterWnd::OnSetCursor(pWnd, nHitTest, message); // Don't allow the cursor to change over splitbar //rmoved for the first version //return FALSE; } void CSplitter::OnMouseMove(UINT nFlags, CPoint point) { CSplitterWnd::OnMouseMove(nFlags, point); // Don't allow the cursor to change over splitbar //CWnd::OnMouseMove(nFlags, point); } //---------------------------------------------------------- Email : Graham.Cunningham@contractor.net Work Tel : 00 41 31 338 0633 Home Tel : 00 41 26 401 4049 //---------------------------------------------------------- -----Original Message----- From: Asaf Kashi [SMTP:kashi@sr.hp.com] Sent: Monday, March 10, 1997 1:54 AM To: 'Mfc-L (E-mail)' Subject: Disallow resize of CSplitterWnd Environment: NT 4.0, VC 4.2b, VC 5.0 I have a CSplitterWnd in my mainframe. It has two views and I want the whole setup to stay the same size. Which message do I need to intercept to prevent the user from being able to use the splitterbar between my panes to resize them and where should I catch it, or is there an easier way? Thanks, Asaf --- Asaf Kashi Software Development Engineer Hewlett Packard - Santa Rosa Systems Division kashi@ap.net http://www.ap.net/~kashi kashi@sr.hp.com hp: http://styx.sr.hp.com/kashi -----From: Mark Lambert I woud derive from CSplitterWnd and override HitTest to return noHit (defined in WinSplit.cpp to be 0). Mark "Remember - it's better to have what you've got, than to get rid of it and not have it. That's what I reckon." - Berk, The Trap Door. >---------- >From: Asaf Kashi[SMTP:kashi@sr.hp.com] >Sent: Monday, March 10, 1997 12:53 AM >To: 'Mfc-L (E-mail)' >Subject: Disallow resize of CSplitterWnd > >Environment: NT 4.0, VC 4.2b, VC 5.0 > >I have a CSplitterWnd in my mainframe. It has two views and I want the >whole setup to stay the same size. >Which message do I need to intercept to prevent the user from being able >to use the splitterbar between my panes to resize them and where should >I catch it, or is there an easier way? > >Thanks, >Asaf >--- >Asaf Kashi >Software Development Engineer >Hewlett Packard - Santa Rosa Systems Division >kashi@ap.net http://www.ap.net/~kashi >kashi@sr.hp.com hp: http://styx.sr.hp.com/kashi > > -----From: "Ganpu Ying" Override the following three virtual functions and two messages virtual void StartTracking(int ht); virtual void StopTracking(BOOL bAccept); virtual void SetSplitCursor(int ht); WM_MOUSEMOVE and WM_SETCURSOR implementation in your derived class will do nothing! G. Ying
Mike Dile -- mikedile@us.ibm.com Friday, March 14, 1997 Classification: Prologue: Mike Dile IBM Storage Systems Division ADSM Client Development Phone: (408)256-3637 Internal: mikedile@ibmusm51 Internet: mikedile@us.ibm.com Epilogue: >Environment: NT 4.0, VC 4.2b, VC 5.0 >I have a CSplitterWnd in my mainframe. It has two views and I want the >whole setup to stay the same size. >Which message do I need to intercept to prevent the user from being able >to use the splitterbar between my panes to resize them and where should >I catch it, or is there an easier way? Take a look at the split32 example on your msdn. Basically you need to trap WM_SETCURSOR, WM_MOUSEMOVE, and WM_LBUTTONDOWN for your (derived) CSplitterWnd. Mike Dile ADSM Client Development IBM Corp.
Become an MFC-L member | Вернуться в корень Архива |