![]()  | 
 
CXTPDialogs/toolbars/image lists.. | 
 
    Post Reply  
   | 
  
| Author | |
   
   ddlittle  
   
   Senior Member  
   Joined: 19 February 2004 Location: United States Status: Offline Points: 132  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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 oneimgList16.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 
    | 
 |
![]()  | 
 |
   
   Oleg  
   
   Senior Member  
   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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  | 
 |
![]()  | 
 |
   
   ddlittle  
   
   Senior Member  
   Joined: 19 February 2004 Location: United States Status: Offline Points: 132  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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;}  | 
 |
![]()  | 
 |
   
   ddlittle  
   
   Senior Member  
   Joined: 19 February 2004 Location: United States Status: Offline Points: 132  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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 
 | 
 |
![]()  | 
 |
    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  |