|
|
|
|
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 |
|
David Tardio
|
Apr 7, 2009 - 10:10 AM
|
Hello
I have an MDI application with a toolbar of type CExtToolControlBar. The thing is that I want to hide some of its buttons at runtime, but everytime I call GetButtonCtrl(int nIndex) on my CExtToolControlBar attribute in my CMainFrame object I always get NULL in return no matter which index I use. I use the ’CommandToIndex( UINT uCmd)’ method for getting the indexes. The indexes seem to be OK, but I always get NULL as a result of calling GetButtonCtrl. I’ve tried it even on the OnCreate method on CMainFrame with identical result.
I’m desperated. Could you help me please?
Thanks in advance
|
|
David Tardio
|
Apr 8, 2009 - 7:29 PM
|
First of all, thanks a lot for your quick reply. Yes, I tried to step into the CExtToolControlBar::GetButtonCtrl() method, but as you said in your reply, I shouldn’t have used that method for getting a pointer to the button handler (CExtBarButton*). I tried to hide my buttons in my toolbar that way because I show that code elsewhere, maybe in www.codeproject.com. Fortunately, the CExtToolControlBar::GetButton() method has worked perfectly! Thanks a lot again!
|
|
Technical Support
|
Apr 7, 2009 - 1:01 PM
|
The CExtToolControlBar::GetButtonCtrl() method just invokes the CExtBarButton::CtrlGet() method. Both methods are widely used inside Prof-UIS. Did you triy to step into these methods while debugging?
If you are using customizable toolbars and menus, then you should not use these methods. The customizable toolbars and menus are using built-in text fields and combo box fields which are not based on the HWND window handles.
In any case you don’t need to know window handles. To hide toolbar button you should invoke the following code:
CExtBarButton * pTBB = . . .
pTBB->SetStyle( pTBB->GetStyle() | TBBS_HIDDEN );
|
|