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 » How to sset caption to CExtControlBar and its tab of the TabControl? Collapse All
Subject Author Date
Gevork Odabashyan Apr 14, 2004 - 7:18 AM

Hello,


I have two CExtControlBars, docked relatively to each other via Your Tab Control. How can I programmatically set caption both to thats ControlBars and correspoding tabs of the Tab Control? 


Thank You
Ruslan

Technical Support Apr 15, 2004 - 2:00 AM

Dear Gevork,

The control bar is a window and so you can use the SetWindowText function to change the caption’s text. If the control bar is inside the dynamic tab container, you should manually update the tab’s caption using the following code:

// you will need some headers, so
#include <../Src/ExtControlBarTabbedFeatures.h>
 
...
 
// set a new text to the control bar caption
pControlBar->SetWindowText( _T("New Caption") );
 
CWnd * pWndParent = pControlBar->GetParent();
ASSERT_VALID( pWndParent );
if( pWndParent->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar)) )
{    
    // the control bar is inside the tab container
    CExtDockDynTabBar * pDockDynTabBar =
        DYNAMIC_DOWNCAST( CExtDockDynTabBar, pWndParent );
    ASSERT_VALID( pDockDynTabBar );
 
    CExtDynTabControlBar * pParentBar =
        STATIC_DOWNCAST(
            CExtDynTabControlBar,
            pDockDynTabBar->GetParent()
        );
    ASSERT_VALID( pParentBar );
  
    pParentBar->SetSwitcherSelection(
        pParentBar->GetSwitcherSelection(),
        false,
        true
    );
}

Gevork Odabashyan Apr 15, 2004 - 2:29 AM

Hi


Thanks for Your answer. Your code works, my problem are strolngly reduced, but I still have one problem - the caption of CExtControlBar is changed immediatlly ONLY when its not inside the tab control. If we have such tab control, the caption is changed only after the tab is first time switched (The text on tab control is changed too). We can send attachment with screen splashes to You if You want.


Thank You


Ruslan Marchenko, the UI designer of Gevork Odabashyan Ltd.

Technical Support Apr 15, 2004 - 6:03 AM

Dear Ruslan,

To change the caption’s text in the single control bar it is enough to call the SetWindowText function. But if the control bar is tabbed with other bars, you should also take care about updating the dynamically created control bar that contains the tabs ( CExtDynTabControlBar ) as we have already done in the previous message. We tested this code in the MDIDOCVIEW sample and everything works OK.
Please send us your test project so that we can help you fix the problem.

Gevork Odabashyan Apr 20, 2004 - 8:13 AM

Hi


Thanks for Your answer. But now I’v got another problem - how to change caption in control bar ONLY and to evoid change tab’s text simultaniosly.


Thank You,


Ruslan.

Technical Support Apr 21, 2004 - 11:14 AM

Dear Ruslan,

The tabbed bars container is an instance of the CExtDynTabControlBar class, which is an internal Prof-UIS class derived from CExtControlBar. The captions of the tab-group and the tab control are parts of the CExtDynTabControlBar window. So, we need to do some tricky operations to change the text of the tab-item independently of the caption text. We have added a new virtual method to the CExtControlBar class to provide the Prof-UIS framework with a flexible way of setting texts for the captions and tab items of the control bar. Please check your e-mail for the source code update.

Gevork Odabashyan Apr 23, 2004 - 7:57 AM

Hi


Greate thanks for You support. You code seems to work correctly except the case when the window subclassed from the new CExtControlBar class is in floating state. Mo matter whether this window is floats single or in a tab-group. There are no calls to OnGetBarCaptionText virtual function in this case. May be you hadn’t implement the support for this case? Or I missunderstand something?


Thank You, with best regards,


Ruslan

Technical Support Apr 25, 2004 - 12:18 PM

Dear Ruslan,

We can not confirm that CExtControlBar::OnGetBarCaptionText is not called. If your bar is single in its floating palette, then the eBCT parameter of the CExtControlBar::OnGetBarCaptionText virtual method is set to __EBCT_SINGLE_CAPTION_FLOATING value. You can easily learn how this virtual method works if you uncomment several lines at the end of this method in the ExtControlBar.cpp file. These commented lines append some suffixes to the bar captions and you can see where your bars are really located. Do not hesitate to contact us in case of any problems.