Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » AutoHide enable/disable of CExtDynamicControlBar at runtime Collapse All
Subject Author Date
Dave Kymlicka Apr 6, 2005 - 7:19 PM

Is it possible to enable/disable AutoHide of CExtDynamicControlBar at anytime during runtime?

Example:
1. Start application, allow autohide
CExtControlBar::FrameInjectAutoHideAreas(pMainFrame)
2. do stuff with app
3. Disable autohide
4. do more stuff with app
5. Enable autohide

As far as I can tell from the code, I would have to perform the following:

// Disable AutoHide
// --------------------------
for each CExtDynamicControlBar
{
// AutoHideModeSet() doesn’t work if control bar is floating
pBar->Dock();

// Turn off autodhide for each bar
pBar->AutoHideModeSet(false, false, true, true);

// remove AutoHide button in bar’s NCarea
pBar->NcButtons_RemoveAt(...)
}
CExtControlBar::FrameInjectAutoHideAreas(NULL);


// Enable AutoHide
// --------------------------
CExtControlBar::FrameInjectAutoHideAreas(pMainFrame);
for each CExtDynamicControlBar
{

// AutoHideModeSet() doesn’t work if control bar is floating
pBar->Dock();

// Turn off autodhide
pBar->AutoHideModeSet(false, false, true, true);

// Add AutoHide button in bar’s NCarea
NcButtons_Add(...)
}


Is this correct? Or do you have a magic global setting in the command manager that I should use instead?

Technical Support Apr 7, 2005 - 1:31 PM

No, we never tried to implement a kind of CExtControlBar::Frame_EJECT_AutohideAreas() method which enables the behavior you described. Of course, we could add this feature but won’t it be confused for the users?

Dave Kymlicka Apr 9, 2005 - 4:01 PM

Are you talking about what happens when "EJECTING" controlbars that are already autohiding?
It should exhibit the same behaviour as if the user clicked the "pin" button on all controlbars at once: they would all simply become visible (docked, of course), and the "pin" button should disappear.

Re-enabling this feature should re-display the "pin" button, and the user can take it from there, autohiding as they see fit.

The only "confusing" part I can imagine is what happens when loading controlbar state from CArchive (at ANY time during runtime, NOT just in MainFrame::OnCreate()): if the user had controlbars that were auto-hidden and the current state of this feature was disabled. Again however, I would perform the behaviour mentioned above: simply dock them, and make them visible.

Technical Support Apr 10, 2005 - 12:20 PM

Of course we can code a method which would destroy auto-hide areas and return all the auto-hidden control bars (if any) to the docked state. But when any control bar toggles its state, it forgets about its previous state and this is logically correct. Besides we do not see any reason to destroy auto-hide grouped tabs. In your project, you can use your own control bars and implement m_bReturnToAutoHidden state boolean flag in them. You would simply return all the auto-hidden bars into the docked state and set their m_bReturnToAutoHidden to true. When appropriate, you would return marked control bars back to the auto-hidden state.

Dave Kymlicka Apr 11, 2005 - 7:44 PM

Yes, you are correct: I can code up a solution that removes all auto-hidden bars and docks them back into mainframe, no problem. My concerns are about calling CExtControlBar::FrameInjectAutoHideAreas(NULL) afterwards: will this work OK, or cause problems?

Technical Support Apr 12, 2005 - 7:50 AM

The CExtControlBar::FrameInjectAutoHideAreas() method is designed to be called only once for the frame window and your code should pass a valid pointer to the frame window as the method’s argument. You cannot specify NULL there. This should not bring any problems to you because when you return all auto-hidden control bars back to the docked sate, all auto-hide areas become invisible. The CExtControlBar::FrameInjectAutoHideAreas() simply creates grouped tabs inside the frame window and places these tabs in an appropriate Z-order. So, all the resizable control bars will be able to find these auto-hide areas and detect availability of the auto-hide feature. This is required to initialize instances of pin-buttons in captions of resizable control bars.

Dave Kymlicka Apr 12, 2005 - 8:57 AM

OK, that’s what I needed to know. Thanks!