Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Big icon in xtpControlButtonPopup
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Big icon in xtpControlButtonPopup

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: Big icon in xtpControlButtonPopup
    Posted: 10 May 2008 at 11:27am
I have a popup-menu in my ribbon. Its drop-down menu contains ~10 items with their corresponding small icons. When I select these sub-items, I want the button in the ribbon to get its big icon.
 
That way, the user understands which item is selected.
 
Q: How do I update this big icon elegantly?
 
At the moment I store the icon-ID of the menu item when it is being selected, and then call pControl->SetIconIndex in the update-handler of the popup-button. Hence, I get a 16x16-icon when I want a 32x32-icon!
 
I believe CXTPControlButton should be able to hold two icons! Then I could call this in the menu-handler:
m_selectedIconID = pControl->GetLargeIconID();
 
Any other ideas?
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 10 May 2008 at 11:32am
Seems this did the trick (maybe you can explain why it works? :P)
 
When creating the popup-item:
XTPImageManager()->SetIcon(hLargeIcon, pControl->GetID(), CSize(32, 32));
XTPImageManager()->SetIcon(hSmallIcon, pControl->GetID(), CSize(16, 16));
 
When selecting the popup-item:
m_selectedIconID = tagNMCONTROL->pControl->GetIconId();
 
Then in the update-handler of the popup itself:
pPopup->SetIconId(m_selectedIconID);
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.109 seconds.