Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Adding icon to a popup Item
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Adding icon to a popup Item

 Post Reply Post Reply
Author
Message
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Topic: Adding icon to a popup Item
    Posted: 02 October 2014 at 8:10am
Hi, 

I am trying to add an icon to an item popup menu. But when I open the popup menu it shows nothing.


CXTPPopupBar *pChildBar =  (CXTPPopupBar*)((CMainFrame *)AfxGetMainWnd())->m_pPopupHistory->GetCommandBar();

//******** manually create Control Button *************************
CXTPControlButton  *pItem = (CXTPControlButton*) CXTPControlButton::CreateObject();
pItem->SetID(ID_TOC_HISTORY);
pItem->SetCaption(m_TreeCtrl.GetItemText(m_TreeCtrl.GetSelectedItem()));
pItem->SetIconSize(CSize(32,32));
pItem->SetIconId(IDB_PNG_HISTORY); <-- Seems to do nothing

//********************************************************************
CXTPControl* pMenuItem = pChildBar->GetControls()->InsertAt(pItem,0); // add item created before to the menu.


What seems to be the problem in the code above ?

regards,


Just me!
Back to Top
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Posted: 02 October 2014 at 8:45am
Ok I solve it with the code below


UINT nID_History[] = {ID_TOC_HISTORY};
pCommandBars->GetImageManager()->SetIcons(IDB_PNG_HISTORY, nID_History, _countof(nID_History), CSize(16, 16), xtpImageNormal);

But why didn't work with the SetIconId() ?

Regards,


Just me!
Back to Top
Willowmaster View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 July 2010
Location: Netherlands
Status: Offline
Points: 180
Post Options Post Options   Thanks (0) Thanks(0)   Quote Willowmaster Quote  Post ReplyReply Direct Link To This Post Posted: 02 October 2014 at 8:47am
Different icon size maybe?
Product: Xtreme SuitePro (ActiveX) version 15.3.1

Platform: Windows XP (32bit) - SP 3 (on VMWare)

Language: Visual Basic 6.0



Back to Top
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Posted: 03 October 2014 at 11:32am
Originally posted by Willowmaster Willowmaster wrote:

Different icon size maybe?

Hi,

No its the same.... Confused
Just me!
Back to Top
Willowmaster View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 July 2010
Location: Netherlands
Status: Offline
Points: 180
Post Options Post Options   Thanks (0) Thanks(0)   Quote Willowmaster Quote  Post ReplyReply Direct Link To This Post Posted: 03 October 2014 at 4:22pm
In your examples you use two different icon sizes. 16X16 and 32X32. Not sure if it was clear what I meant.
Product: Xtreme SuitePro (ActiveX) version 15.3.1

Platform: Windows XP (32bit) - SP 3 (on VMWare)

Language: Visual Basic 6.0



Back to Top
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Posted: 04 October 2014 at 5:16am
Originally posted by Willowmaster Willowmaster wrote:

In your examples you use two different icon sizes. 16X16 and 32X32. Not sure if it was clear what I meant.

Yes you are right, sorry for my mistake in the examples above, but in the real code inside my project, I have already corrected my mistake at the very beggining and the result is just the same.......

I think that the problem is that I have to store the image inside the Image Manager before I call the SetIconId() to take care some parameters.........

Regards,



Just me!
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.141 seconds.