Kirix Support Forums

wxAuiBar size determination

Please post all general questions, comments, bug reports, and any other wxAUI feedback here.

wxAuiBar size determination

Postby NinjaNL on Tue Aug 26, 2008 2:41 am

Probably an easy question for those in the know.

When a toolbar is created, what is the best/easiest method of determining it's size?

Take for example a horizontal toolbar. When the orientation is changed to vertical, I need to specify a new BestSize for the toolbar. How would/should I determine this?

Does anyone have code to share?
NinjaNL
Registered User
 
Posts: 40
Joined: Thu Jun 14, 2007 6:53 am

Re: wxAuiBar size determination

Postby Dave on Tue Aug 26, 2008 10:42 am

Hello,

Good question. We've needed to do this in a couple of places as well. Here's how to do it:

Code: Select all
wxAuiPaneInfo& pane = aui_mgr.GetPane(aui_toolbar);
wxSize s = aui_toolbar->GetMinSize();
pane.BestSize(s);
aui_mgr.Update();

You may need to set the min size as well as the best size, however, since wxAuiToolBar uses sizers internally for layout. If you want to do this, you'd do the following:

Code: Select all
wxAuiPaneInfo& pane = aui_mgr.GetPane(aui_toolbar);
wxSize s = aui_toolbar->GetMinSize();
pane.MinSize(s).BestSize(s);
aui_mgr.Update();

All the best,
Dave.
Dave Williams
Kirix Support Team
User avatar
Dave
Kirix Support Team
 
Posts: 32
Joined: Wed Sep 21, 2005 11:07 pm

Return to wxAUI Questions, Thoughts & Feedback