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.
Subject |
Author |
Date |
|
Thomas Maurer
|
Apr 22, 2008 - 4:40 AM
|
Hello Sorry if this has been asked many times before... The following situation: I have a tabbed container with two control bars in them that the user can switch forth and back. 
I want to be able to: - get the active tab (index or window pointer/handle) for saving when app closes (e.g. "Dokum..." or "Miniatu..." / 0 or 1 respectively)
- set the active tab when app starts (e.g. "Dokum..." or "Miniatu..." / 0 or 1 respectively) IMPORTANT: The order of the tabs should always remain the same. How can I achieve that? ADDITIONAL INFO: I am creating my own tabbed bar by receiving the g_nMsgCreateTabbedBar message. I could do something on creation of the derived bar. Thanks in advance Thomas
|
|
Technical Support
|
Apr 22, 2008 - 11:05 AM
|
The algorithm that restores the state of control bars recreates the layout of control bars so that all controls bars in each tabbed group is restored including the tab order and selection. You can send a command message to the main frame window to select a control bar in your tabbed group, activate and focus a hidden or a auto-hidden bar: CMainFrame * pMainFrame = . . .
CExtControlBar * pBar = . . .
pMainFrame->SendMessage( WM_COMMAND, WPARAM(pBar->GetDlgCtrlID()) ); That is typically enough in most cases. But you can also access a tabbed control bar and get more info about the tabbed group CExtControlBar * pBar = . . .
CExtDynTabControlBar * pTabBar = pBar->_GetNearestTabbedContainer();
if( pTabBar == NULL )
return . . . // the pBar bar is not in tabbed group
LONG nSelIdx = pTabBar->GetSwitcherSelection();
if( nSelIdx < 0 )
return . . . // some temporarily state during drag-n-drop, typically never occur
CExtControlBar * pBarSelectedInTabGroup = pTabBar->GetBarAt( nSelIdx, true );
ASSERT_VALID( pBarSelectedInTabGroup );
if( LPVOID(pBarSelectedInTabGroup) == LPVOID(pBar) )
{
::AfxMessageBox( _T("We are currently selected in tab group.") );
}
else
{
::AfxMessageBox( _T("We are NOT currently selected in tab group.") );
//
// Select pBar. Same as sending command message to main frame.
//
pTabBar->SelectControlBar( pBar );
}
|
|