Questions about Icons |
Post Reply |
Author | |
Number8
Groupie Joined: 29 July 2008 Location: United States Status: Offline Points: 17 |
Post Options
Thanks(0)
Posted: 03 September 2008 at 7:46am |
Hello,
Using SuitePro ActiveX 12.0.1. Could someone point me to the area in the documentation that describes how to get icons to appear on toolbar buttons? I am trying to load the icons from a bitmap and assign them to toolbar buttons like this: _bstr_t bstrName ="C:\\Program Files\\Codejock Software\\ActiveX\\SuitePro ActiveX 12.0.1\\Samples\\CommandBars\\C#.NET\\RibbonSample\\res\\LargeIcons.bmp"; int cmds[18]; cmds[0] = M_FILE_NEW; cmds[1] = 2; /* etc */ IImageManagerIconsPtr pIcons = pCommandBars->GetIcons(); pIcons->LoadBitmap(bstrName, cmds, xtpImageNormal); ICommandBarActionsPtr pActions = pCommandBars->GetActions(); pControls = pCommandBar->GetControls(); pAction = pActions->Add(M_FILE_NEW, _bstr_t("&New"), _bstr_t("Create a new document"), _bstr_t("Create a new document"), _bstr_t("File")); pAction->IconId = M_FILE_NEW; pControls->Add(xtpControlButton, M_FILE_NEW, ""); However, no icons appear on the toolbars. What am I doing wrong? I searched the samples for a use of LoadBitmap() or IconId in a .cpp file, but didn't find any. I tried to follow the use of LoadBitmap() as used in some .cs files, but those uses of LoadBitmap() are for controls other than a CommandBar. Thanks for any pointers... UPDATE: I tried explicitly setting the style: pControl = pControls->Add(xtpControlButton, M_FILE_NEW, ""); pControl->PutDescriptionText(_bstr_t("Create a new document")); pControl->PutStyle(xtpButtonIcon); Still no icon... |
|
Product: Xtreme SuitePro (ActiveX) version 12.1.0
Platform: Windows XP (32bit) - SP 3 Language: C / C++ |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
CommandBars.Icons = ImageManager.Icons;
|
|
Number8
Groupie Joined: 29 July 2008 Location: United States Status: Offline Points: 17 |
Post Options
Thanks(0)
|
I'm confused: _DCommandBars->GetIcons() returns a pointer to an ImageManagerIcons object. ImageManagerIcons doesn't have an Icons property. struct __declspec(uuid("1616dc35-b997-432b-ab4f-439341a769e5")) _DCommandBars : IDispatch { /* snip */ __declspec(property(get=GetIcons,put=PutIcons)) IImageManagerIconsPtr Icons; /* snip */ }; IImageManagerIcons : IDispatch { /* snip */ HRESULT LoadBitmap ( _bstr_t Path, const _variant_t & Commands, enum XTPImageState imageState ); /* snip */ ]; After calling LoadBitmap() on the ImageManagerIcons object, is there another step to adding it back to the CommandBars object? Thanks for the reply. |
|
Product: Xtreme SuitePro (ActiveX) version 12.1.0
Platform: Windows XP (32bit) - SP 3 Language: C / C++ |
|
Number8
Groupie Joined: 29 July 2008 Location: United States Status: Offline Points: 17 |
Post Options
Thanks(0)
|
Tech support provided the answer.
Need to pass a SafeArray that can be cast to Variant to LoadBitmap(). CComSafeArray<int> safeCommands(_countof(cmds)); for (int i = 0; i < _countof(cmds); ++i) { safeCommands.SetAt(i, cmds); } HRESULT hr = pIcons->LoadBitmap(bstrName, CComVariant((LPSAFEARRAY)safeCommands), xtpImageNormal); |
|
Product: Xtreme SuitePro (ActiveX) version 12.1.0
Platform: Windows XP (32bit) - SP 3 Language: C / C++ |
|
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 |