![]() |
Toolbar and images |
Post Reply
|
| Author | |
radcap
Newbie
Joined: 16 April 2008 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Topic: Toolbar and imagesPosted: 16 April 2008 at 10:40am |
|
Hello,
searching through topics I could not fully realize if I can make a true dynamic setup for toolbars: I need a popup toolbar with xtpButtonIconAndCaption button styles, and it has to allow dynamic addition of buttons (say, for plugins). How can I set it up so I get icons displayed? Right now I can only see the captions, but no icons. Can you tell me whether I can achieve such behavior and if I can, then how? I use XTP v9.60 (and there are reasons that restrict me to this version :-( ) |
|
![]() |
|
radcap
Newbie
Joined: 16 April 2008 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Posted: 17 April 2008 at 7:23am |
|
If I wasn't too clear: In the discussion there are advices to use ->ImageManager()->SetIcon(s) method to add images to the manager, and then all one needs is just to use CXTPControl::SetIconId() method.
I try to achieve this at runtime as this:
Plugin gets loaded and fetches a pointer to the toolbar. It may add controls to the toolbar, but I've been unable to attach icons to the controls.
If I understand all clear, the plugin needs first to SetIcon() to attach its icon to imagemanager and then just to call SetIconId() for the added control. But icon doesn't show up. What am I doing wrong?
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 17 April 2008 at 8:45am |
|
Hi,
try instead of global XTPImageManger call
m_wndToolBar.GetImageManager()->SetIcons(...);
just set icon with Id of button and you don't need to call SetIconId for this case.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
radcap
Newbie
Joined: 16 April 2008 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Posted: 17 April 2008 at 10:00am |
|
:-)
Yeah, that wasn't really obvious from my post, but I do use toolbar's ImageManager :-) |
|
![]() |
|
radcap
Newbie
Joined: 16 April 2008 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Posted: 17 April 2008 at 10:46am |
|
Here's the code from main application (not a plugin), the problem resides with it as well:
|
|
![]() |
|
radcap
Newbie
Joined: 16 April 2008 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Posted: 17 April 2008 at 1:16pm |
|
Hi again.
Hmm, I think now I need some explanation: in the code I posted earlier I used SetIcon method. The bitmap itself, though is a toolbar resource, is an image of a single button (so I wanted to set it twice for both buttons). I changed the code to this:
and all went good, I've got my image displayed on the button. After that, I've found out that to set image for the second button (which in fact is in the different command bar, thus I'm showing only one button in the code here) I need to use another ImageManager, but that means little now, because the idea itself works. So, why doesn't the SetIcon work as I expected it would? LoadBitmap definetly returned the needed bitmap, I've checked that out. Is this an issue with XTP 9.60, or I still did something wrong? |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 17 April 2008 at 1:22pm |
|
This conversion:
CXTPImageManagerIconHandle xtpIconHandle(hBitmap);
only works for alpha bitmaps.
use SetIcons method instead.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
radcap
Newbie
Joined: 16 April 2008 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Posted: 17 April 2008 at 1:36pm |
|
Oh, that explains things :-)
Thanks for your help and immense amount of info on the forum, I think I wouldn't find the solution so quick without it. |
|
![]() |
|
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 |