Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - CXTPDialogs/toolbars/image lists..
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPDialogs/toolbars/image lists..

 Post Reply Post Reply
Author
Message
ddlittle View Drop Down
Senior Member
Senior Member


Joined: 19 February 2004
Location: United States
Status: Offline
Points: 132
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddlittle Quote  Post ReplyReply Direct Link To This Post Topic: CXTPDialogs/toolbars/image lists..
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
ddlittle View Drop Down
Senior Member
Senior Member


Joined: 19 February 2004
Location: United States
Status: Offline
Points: 132
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddlittle Quote  Post ReplyReply Direct Link To This Post 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;

}

Back to Top
ddlittle View Drop Down
Senior Member
Senior Member


Joined: 19 February 2004
Location: United States
Status: Offline
Points: 132
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddlittle Quote  Post ReplyReply Direct Link To This Post 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
 
 
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.049 seconds.