Print Page | Close Window

CXTPDialogs/toolbars/image lists..

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=5158
Printed Date: 04 March 2025 at 8:06am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPDialogs/toolbars/image lists..
Posted By: ddlittle
Subject: CXTPDialogs/toolbars/image lists..
Date Posted: 27 September 2006 at 10:58am
I have an app that's based on CXTPDialog - I have a toolbar on it and everything there works fine.  Now I want to add my standard buttons, but can't seem to make that work.
 
This is the code I use for all apps with a frame --
 

CImageList imgList32;

CImageList imgList16;

HRESULT hr;

imgList32.Create(32,32,ILC_COLORDDB|ILC_MASK,0,1);

imgList16.Create(16,16,ILC_COLORDDB|ILC_MASK,0,1);

stdButtons = new UINT[btnCount];

for(int x=0;x<btnCount;x++)

{

stdButtons[x] = iconIds[x].cmd;

HICON hIcon = ::LoadIcon(iconInst,MAKEINTRESOURCE(iconIds[x].icon));

if(!hIcon)

{

hIcon = AfxGetApp()->LoadStandardIcon(IDI_QUESTION);

}

imgList32.Add(hIcon); // load the 32x32 one

imgList16.Add(hIcon); // and the 16x16

}

// now set both sizes of the images for XTP...

hr= XTPImageManager()->SetIcons((CImageList&)imgList32,stdButtons,btnCount,CSize(32,32));

hr= XTPImageManager()->SetIcons((CImageList&)imgList16,stdButtons,btnCount,CSize(16,16));

SAFE_DELETE(stdButtons);

FreeLibrary(iconInst);

return TRUE;

}
 
But that doesn't seem to work.  I can't get the "toolbar customize" thing to work on this toolbar, either.  Maybe that's a related issue?
 
Thanks!
 
- David



Replies:
Posted By: Oleg
Date Posted: 28 September 2006 at 9:00am
In this code you add icons to imagemanager. but not buttons to toobar.
 
See CXTPCommandBar::SetButtons method or
CXTPControls::Add


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: ddlittle
Date Posted: 28 September 2006 at 11:31am

I create the toolbars a line or two earlier, then call the function whose code was posted earlier (SetupIcons).

Here's the code:
 

BOOL CCommonAnalysisDialog::CreateToolbar(const UINT menuID /* = IDR_STATICMENU */, const UINT toolBarID /* = IDR_STATICTOOLS */)

{

InitCommandBars();

CXTPCommandBars* pCommandBars = GetCommandBars();

pCommandBars->SetMenu("Menu Bar",menuID);

CXTPToolBar* pToolBar = pCommandBars->Add("Standard",xtpBarTop);

pToolBar->LoadToolBar(toolBarID);

RepositionControls();

SetupIcons(sizeof(iconIDs)/sizeof(iconIDs[0]),(const UINT*)&iconIDs);

pCommandBars->GetShortcutManager()->SetAccelerators(menuID);

return TRUE;

}



Posted By: ddlittle
Date Posted: 28 September 2006 at 2:02pm
Oleg,
 
Now I know why you were thinking "this guy doesn't know what he's doing" ---
 
 
I found out what was was wrong --- Whoever designed this dialog the first time used 24x24 toolbars and I only have images for 16x16 and 32x32.  when I changed the toolbar button size from 24x24 to 16x16, all my Icons show up just fine...
 
Thanks!
 
- David
 
 



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