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 » Hiding event & control bar enumeration Collapse All
Subject Author Date
a a Jan 29, 2006 - 6:50 PM

Is there a way to set a handler for when an user hides a control bar?
Since there are many ways to hide a control bar, including command id and clicks on the close button, I would like to know the official way to do it.
(I couldn’t find any way to handle the clicks on the close button. I tried overriding OnClose, OnShowWindow etc... but no good.)


And is there a way to enumerate existing control bars in an MDI frame window?
Actually I’d like to check if there is a control bar "docked on the left border" and grab the first one if so.


Thanks.

Technical Support Jan 30, 2006 - 5:55 AM

The CFrameWnd::m_listControlBars member is a list container with pointers to all the control bars in the frame window. Your can traverse the pointers in this list and assume that each of them is a CControlBar object or derived from it. This list also contains all the control bar containers which are CDockBar objects or derived from it. The CDockBar class is also derived from CControlBar class. But you can simply find Prof-UIS control bars by applying the DYNAMIC_DOWNCAST() macro to all the pointers in the list and specifying Prof-UIS types such as CExtControlBar or CExtToolControlBar.

You can detect any change in the window state of a control bar state by handling the following standard windows messages: WM_SHOWWINDOW, WM_SIZE or WM_WINDOWPOSCHANGED. You can explicitly control the caption buttons. Each caption button is an object of the CExtBarNcAreaButton class or derived from it. They are initialized in the CExtControlBar::OnNcAreaButtonsReinitialize() virtual method. You can override it and initialize your own buttons.




a a Jan 30, 2006 - 7:45 PM

Why is WM_SHOWWINDOW only sent at initialization and destruction?


Is there no message or event handler method for when the user hides/shows a control bar?


Currently, I’m overriding both OnUpdateControlBarMenu and the derived close button’s OnNcAreaClicked,
but I think it’s kinda weird.

a a Jan 30, 2006 - 7:52 PM

I meant OnBarCheck sorry.

Technical Support Feb 6, 2006 - 11:49 AM

To detect when the bar changes its visibility is a tricky task. Potentially, it is possible to access the internal Prof-UIS bar classes which implement the tabbed container or linear bar container for organizing a row of bars inside a column and vice versa. It is possible to hide these types of bars and this will affect the visibility of all the children bars. Of course, you can the OnBarCheck()-based method if you want to intercept all the bar’s command invocations.

a a Jan 30, 2006 - 7:03 PM

Thanks.


So it means I need to derive the close button... I will try it.
I didn’t know there was a list for control bars. Now I can enumerate control bars.


Is there a method to check the state of a control bar (ProfUIS’s)?
I mean, docked/floating/tabbed. And if docked, to which border.


    DockControlBar(AFX_IDW_DOCKBAR_LEFT, circle); // <--- I wish I could access to this flag...

Technical Support Feb 6, 2006 - 11:43 AM

The CExtControlBar::IsFloating() method returns true only if the bar is floating and it’s the single bar in its floating palette. So, you can use this method only for any fixed size bar like the toolbar. The CWnd::GetParentFrame() method returns a pointer to the nearest CFrameWnd window in the chain of the parent windows. You can use this method with control bars and it will return a pointer to the main frame window or to a CMiniFrameWnd (in fact, CExtMiniDockFrameWnd) window for floating bars. To detect whether the bar is in the tabbed bar container, you need to invoke CExtControlBar::_GetNearestTabbedContainer() which returns a pointer to the tabbed container bar or NULL. It is possible to detect the side of the main frame window and the circle number where the bar is. Traverse all the parent windows of the bar up to the main frame window, detect the last CExtDockBar window and invoke its CWnd::GetDlgCtrlID() method which will return AFX_IDW_DOCKBAR_LEFT, AFX_IDW_DOCKBAR_RIGHT, AFX_IDW_DOCKBAR_TOP or AFX_IDW_DOCKBAR_BOTTOM depending on the side of the main frame window with which the bar is docked. To get the nested circle number, call the CExtDockBar::_GetCircleNo() method. To analyze the runtime classes, just include the ExtDockBar.h and ../Src/ExtControlBarTabbedFeatures.h files into your project independently from the Prof-UIS.h file.

a a Feb 6, 2006 - 6:01 PM

Thanks.