Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - CXTPToolBar, CImageList problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPToolBar, CImageList problem

 Post Reply Post Reply
Author
Message
hpesata View Drop Down
Groupie
Groupie


Joined: 16 July 2004
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote hpesata Quote  Post ReplyReply Direct Link To This Post Topic: CXTPToolBar, CImageList problem
    Posted: 17 February 2005 at 9:52am
Hi!

XTreme Toolkit Pro V 9.51:

I am trying to create a toolbar with bitmaps loaded from files instead of resource-bitmaps.
I am creating the CXTPToolBar with
pStandardBar = GetCommandBars()->Add(_T("Standard"), xtpBarTop).

I am saving the bitmap-objects into a CImageList-object and use the following code to add it to the toolbar:

XTPImageManager()->SetIcons(myimagelist, CmdIds, nImgs, CSize(16, 16));
RecalcLayout(FALSE);
GetCommandBars()->RedrawCommandBars();

The images appear in my menu at the correct position, but they dont appear in the toolbar,
it stays empty.

What do I have to do to make the images visible in the toolbar too ?

Many thanx in advance!

best regards,
Hans Pesata

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 17 February 2005 at 2:09pm
How do you set controls for Toolbar? Are you sure it has Ids from CmdIds collection?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
hpesata View Drop Down
Groupie
Groupie


Joined: 16 July 2004
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote hpesata Quote  Post ReplyReply Direct Link To This Post Posted: 18 February 2005 at 2:20am
Hi!

// XTPImageManager()->SetIcons(myimagelist, CmdIds, nImgs, CSize(16, 16));

CmdIds is a UINT* with the size of nImgs. this seems to be working, because the images are displayed correctly within my menu.

I am not using LoadToolbar(), because I dont have a resource.

do I have to do something that is done within LoadToolbar() ?

what do you mean by "how do you set controls" ?

all I currently do is the code I posted.

best regards,
Hans

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 18 February 2005 at 3:44am

When you call

pStandardBar = GetCommandBars()->Add(_T("Standard"), xtpBarTop).
you create toolbar without buttons.

Now you must add buttons you need:

pStandardBar->GetControls()->Add(xtpControlButton, CmdIds[0]);

pStandardBar->GetControls()->Add(xtpControlButton, CmdIds[1]);

 

or

pStandardBar->SetButtons(CmdIds, nImgs);

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
hpesata View Drop Down
Groupie
Groupie


Joined: 16 July 2004
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote hpesata Quote  Post ReplyReply Direct Link To This Post Posted: 18 February 2005 at 1:26pm
Hi Oleg!

thanx for your support!

I added your code and the toolabr buttons are displayed now too.
I am using the following code:

XTPImageManager()->SetMaskColor(RGB(0, 255, 0));
XTPImageManager()->SetIcons(myimagelist, CmdIds, nCmdIds, size, CSize(16,16));
XTPImageManager()->RefreshAll();

the problem I have now is, that the mask-color doesnt work. I am using green RGB(0, 255, 0) within my bitmaps to mark the transparent pixels and also use the appropriate SetmaskColor() call, but the green pixels within the bitmaps stays visible instead of being replaced by the underlying colors.

any hints on how to solve that ?

best regards,
Hans

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.195 seconds.