Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - dynamically add buttons to toolbar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

dynamically add buttons to toolbar

 Post Reply Post Reply
Author
Message
spelhatre View Drop Down
Newbie
Newbie


Joined: 09 January 2006
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote spelhatre Quote  Post ReplyReply Direct Link To This Post Topic: dynamically add buttons to toolbar
    Posted: 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();
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: 25 January 2006 at 10:54am

Is it dialog application?

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
spelhatre View Drop Down
Newbie
Newbie


Joined: 09 January 2006
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote spelhatre Quote  Post ReplyReply Direct Link To This Post Posted: 26 January 2006 at 2:11am

Back to Top
spelhatre View Drop Down
Newbie
Newbie


Joined: 09 January 2006
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote spelhatre Quote  Post ReplyReply Direct Link To This Post Posted: 26 January 2006 at 2:11am
MDI application but the window with the dynamic toolbar is a dialogbox
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: 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);
toolbar->SetWindowPos(&CWnd::wndTop, 0, 0, sz.cx, sz.cy, SWP_NOMOVE);

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.078 seconds.