0

Is there any way to make a MFC DockablePane (from the new Feature Pack) that is docked in a window not able to float or to hide (and even disable the context menu that allows the user to select the states - dockable, float, hide etc.)

What I basically want is to have 3 panes on a window that can change their horizontal dimensions, but not their position inside the window. Any suggestion?

melculetz
  • 1,961
  • 8
  • 38
  • 51

3 Answers3

4

The solution is to extend the CDockablePane and override in this class the following events:

virtual BOOL CanFloat() const;
virtual BOOL CanBeClosed() const;
virtual BOOL CanAutoHide() const;

so that they return FALSE;

for more information see MSDN Customization Tips for the MFC Extensions

melculetz
  • 1,961
  • 8
  • 38
  • 51
  • Thanks for the answer, it helped me as well. Just one comment: Override also CanBeAttached() if you do not want to attach other tabs to this one:
    virtual BOOL CanBeAttached() const {return FALSE;}
    A strange thing: if your CanBeClosed() function returns FALSE, the [x] (close) button will not be shown for this tab. BUT! If the tab is attached with another one that can be closed, the [x] button will be closed for both tabs and it will be possible to close both tabs. So if you have 'mixed behavior' tabs, they should not be attached one to another.
    – Mar Jul 28 '09 at 11:03
1

Try changing the dwControlBarStyle when you create the window (with CDockablePane::Create).

user60280
  • 11
  • 1
  • the only value I found is the default one, which is AFX_DEFAULT_DOCKING_PANE_STYLE ... are there any other? – melculetz Jan 29 '09 at 18:00
  • AFX_DEFAULT_DOCKING_PANE_STYLE is a combination of styles (AFX_CBRS_FLOAT, AFX_CBRS_CLOSE, AFX_CBRS_RESIZE, and AFX_CBRS_AUTOHIDE). The full list is in afxbasepane.h. Just 'or' together the styles you want for your pane. – user60280 Feb 06 '09 at 14:40
1

Another solution is, just call

CBasePane::SetControlBarStyle(AFX_CBRS_RESIZE|AFX_CBRS_CLOSE);
animuson
  • 53,861
  • 28
  • 137
  • 147
Shallyee
  • 11
  • 1
  • Can you add some more context on how this solves the issue or where to place the call? – mrk Nov 09 '12 at 21:27
  • By setting the control bar style to AFX_CBRS_RESIZE and AFX_CBRS_CLOSE, you are omitting AFX_CBRS_FLOAT style effectively removing the style and therefore preventing the pane from floating. – akame May 04 '15 at 13:45