![]()  | 
 
dynamically add buttons to toolbar | 
 
    Post Reply  
   | 
  
| Author | |
   
   spelhatre  
   
   Newbie  
   Joined: 09 January 2006 Status: Offline Points: 15  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Topic: dynamically add buttons to toolbarPosted: 25 January 2006 at 10:30am  | 
 
| 
   
    
   I use control CXTPToolBar and dynamically add buttons: 
   
  toolbar->GetControls()->Add(xtpControlButton, ....) But buttons and not drawn correctly. I see only a part of the first button. If my toolbar is floating, it's OK. But if it is docked (at the top in my case) I have to undock it to see my buttons. I tried several things but unsuccessfully: CSize sz = toolbar->CalcDynamicLayout(0, LM_HORZ); toolbar->SetWindowPos(&CWnd::wndTop, 0, 0, sz.cx, sz.cy, 0); OR toolbar->GetParent()->RepositionBars(AFX_IDW_CON TROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0); OR toolbar->RedrawWindow(); toolbar->UpdateWindow(); toolbar->GetParent()->UpdateWindow();  | 
 |
![]()  | 
 |
   
   Oleg  
   
   Senior Member  
   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 25 January 2006 at 10:54am | 
 
| 
   
    Is it dialog application?  | 
 |
| 
   
     
     Oleg, Support Team 
   
  CODEJOCK SOFTWARE SOLUTIONS  | 
 |
![]()  | 
 |
   
   spelhatre  
   
   Newbie  
   Joined: 09 January 2006 Status: Offline Points: 15  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 26 January 2006 at 2:11am | 
 
| 
   
    | 
 |
![]()  | 
 |
   
   spelhatre  
   
   Newbie  
   Joined: 09 January 2006 Status: Offline Points: 15  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 26 January 2006 at 2:11am | 
 
| 
   
    
   MDI application but the window with the dynamic toolbar is a dialogbox
    
   
   | 
 |
![]()  | 
 |
   
   Oleg  
   
   Senior Member  
   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 27 January 2006 at 12:54am | 
 
| 
   
    Just repeat code you have in OnSize, or call dialog OnSize as method something: CSize sz = toolbar->CalcDynamicLayout(0, LM_HORZ|LM_COMMIT); 
  | 
 |
| 
   
     
     Oleg, Support Team 
   
  CODEJOCK SOFTWARE SOLUTIONS  | 
 |
![]()  | 
 |
    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  |