Print Page | Close Window

Adding icon to a popup Item

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=22426
Printed Date: 05 July 2024 at 10:08am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Adding icon to a popup Item
Posted By: sdancer75
Subject: Adding icon to a popup Item
Date 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!



Replies:
Posted By: sdancer75
Date 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!


Posted By: Willowmaster
Date 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





Posted By: sdancer75
Date 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!


Posted By: Willowmaster
Date 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





Posted By: sdancer75
Date 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!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net