Questions about Icons
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=12056
Printed Date: 24 April 2024 at 2:43am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Questions about Icons
Posted By: Number8
Subject: Questions about Icons
Date 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++
|
Replies:
Posted By: SuperMario
Date Posted: 04 September 2008 at 8:25am
CommandBars.Icons = ImageManager.Icons;
|
Posted By: Number8
Date Posted: 04 September 2008 at 10:06am
SuperMario wrote:
CommandBars.Icons = ImageManager.Icons;
|
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++
|
Posted By: Number8
Date Posted: 09 September 2008 at 9:17am
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++
|
|