Toolbar icons disappear after SetID() |
Post Reply |
Author | |
Alistair
Newbie Joined: 14 May 2004 Status: Offline Points: 15 |
Post Options
Thanks(0)
Posted: 14 May 2004 at 5:22am |
I'm currently evaluating XTToolkit Pro. I'm trying to implement a toolbar with icons and text. Just simple buttons. It all works fine until I assign a command id to a button so that it will actually do something. When I do that, it no longer shows the icon, just the text! Here's my code (in CMainFrame::OnCreate())
CXTPToolBar* pToolBar = (CXTPToolBar*) pCommandBars->Add(_T("PC-BaX Tools"), xtpBarTop); { TRACE0("Failed to create toolbar\n"); } { TRACE0("Failed to load toolbar\n"); } pToolBar->ShowTextBelowIcons() ; CXTPControl *pControl ; pControl = pToolBar->GetControl ( 0 ) ; pControl->SetID ( ID_ACTION_EXECUTIVE ) ; // <-- This stops the icon from being displayed but is the only way I know to assign an action to a button. pControl->SetCaption ( IDS_EXECUTIVE ) ; pControl->SetFlags ( pControl->GetFlags() | xtpFlagManualUpdate ) ; pControl->SetStyle ( xtpButtonIconAndCaption ) ; pControl->SetEnabled ( TRUE ) ; /*...*/ CXTPPaintManager::SetTheme(xtpThemeOffice2003); Any suggestions? --- Al. Ps, how do you change the paragraph settings when posting? I seem to have large spaces between my lines.
|
|
vladsch
Newbie Joined: 04 February 2004 Location: Canada Status: Offline Points: 30 |
Post Options
Thanks(0)
|
You need to associate an icon with the ID with the command bars image manager:
In my case getIcon() returns the icon handle for the current instance of the command and getID() returns the ID of the command, substitute your own code. Image manager makes a copy of the icon so you will need to destroy the icon after the call to SetIcon. |
|
Vladimir,
|
|
Alistair
Newbie Joined: 14 May 2004 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
Just the job. Thanks. --- Al.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |