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 Tech Support » Doc bars in tabs problem Collapse All
Subject Author Date
Offer Har Oct 16, 2006 - 6:36 AM

Hi,

I have a docked bar in a tab array.
I need programmatically to make sure this bar is visible (to select its tab). I don’t know where the tab is docked or it it’s in a tabbed view.

How do i make sure the docked bar is visible?

Thanks.

Technical Support Oct 16, 2006 - 11:42 AM

We can guess that you are asking about dynamic control bars. You can learn if a dynamic control bar is visible and of it is in the document mode using the CExtDynamicControlBar::BarStateGet() method, which returns both CExtDynamicControlBar::eDynamicBarState_t (bar’s location) and the visibility flag. If it is not visible, you can show it in its current state using the CExtDynamicControlBar::BarStateSet() method. If the bar is visible then we can have two cases. If the bar is not in the document mode ( the CExtDynamicControlBar::BarStateGet() method returnes a value not equal to __EDBS_DOCUMENT), you should send the WM_COMMAND message to the main frame window and specify the bar’s dialog control identifier (pBar->GetDlgCtrlID()) in WPARAM. If the bar is in the document mode, you should get a handle of the bar’s child window first by using the CExtDynamicControlBar::OnQueryChildHWND() method. Then activate the parent frame window of the bar’s child window in the MDI application and make the found frame window being the active MDI child frame window. You should find the tab item’s index in the tab page container window (main SDI view) and select this item. The CExtTabPageContainerWnd::GetSafeTabWindow() method will return a pointer to the CExtTabWnd window used inside the tab page container. Enumerated all the tab items in this tab window and compare the LPARAM data of each window with the HWND handle of resizable bar’s child window. Finally you should set selection to the found tab item.

Offer Har Oct 16, 2006 - 8:49 PM

Hi,

All I need is for a specific bar, derived from CExtControlBar to be visible.
It seems to me that there should be some command that will make sure the control bar is visible.
I can show it if it is hidden with no problems, using ShowControlBar of CFrameWnd, but if the bar is docked in a bar with other control bars, and is not hidden, I want to be able to select its tab programmatically.

It seems to me that there should be a function of CExtControlBar called EnsureVisible, or MakeVisible that will handle this - please let me know what API function to use, as i could not find any.

I think that you answer was not answering my question.

Regards,
Offer

Technical Support Oct 17, 2006 - 10:59 AM

Thank you for clarifying the question. You can make a control bar visible (this also ensures it will be selected in a tabbed bar group) by sending the WM_COMMAND message to the main frame window. You should specify the control bar’s dialog control identifier in the WPARAM parameter of this message:

CExtControlBar * pBar = . . .
CMainFrame * pMainFrame = . . .
pMainFrame->SendMessage( WM_COMMAND, WPARAM( pBar->GetDlgCtrlID() ) );

Offer Har Oct 17, 2006 - 3:44 PM

This doe not work.

I will explain again:

I have a button that when pressed should bring a control bar to be displayed:
(a) If the bar is not shown (closed) should show it - this is trivial with ShowControlBar
(b) If the bar is docked with other bars in a tab style, it should be the selected tab, hence the bar is displayed.

Again, it seems to be a very trivial request to have.
I can easily achieve (a), but have no solution for (b) - if the bar is tabbed, i don’t know how to bring it to front.

The answer you gave me is the same as (a) show/hide a tab, but i need it to be the selected tab if tabbed.

Thanks.

Technical Support Oct 18, 2006 - 7:27 AM

To activate a control bar including when it is auto hidden, tabbed or docked, you need to send the WM_COMMAND message to the main frame window. Do not forget to specify control bar’s dialog control identifier in the WPARAM parameter.

The same can be done using the following code:

CExtControlBar::DoFrameBarCheckCmd(    
 pMainFrame,        
 nBarID,        
 false    
 );

This static method activates the control bar specified with nBarID .

Please note that if you use the auto-hide feature, you should implement the following versions of MFC’s OnBarCheck() and OnUpdateControlBarMenu() methods
in the main frame window:

BOOL CMainFrame::OnBarCheck(UINT nID)
{    
 return CExtControlBar::DoFrameBarCheckCmd( this, nID, false );
}
 
void CMainFrame::OnUpdateControlBarMenu( CCmdUI * pCmdUI )
{    
 CExtControlBar::DoFrameBarCheckUpdate( this, pCmdUI, false );
}

Offer Har Oct 18, 2006 - 6:41 PM

Thanks, problem solved.