Kirix Support Forums

[SOLVED]wxCoolBar size changes, but Update() does not resize

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

[SOLVED]wxCoolBar size changes, but Update() does not resize

Postby gnschmidt on Sat Sep 30, 2006 3:07 am

Using a standard wxSizer, I can place a wxCoolBar at the top of the screen and when I hide a bar and then call Layout on the sizer in the frame, the coolbar size is adjusted correctly.

Using wxAUI, the space formerly occupied by the band (a toolbar band in this case) is kept blank when I call Update().

How can I force the manager to recheck the size of the coolbar pane / instruct wxAUI to increase the size of the central pane if more space becomes available?

My panes are created as follows:

Code: Select all
manager.AddPane(coolBar, wxPaneInfo().Top().CaptionVisible(false));
manager.AddPane(mainBook, xPaneInfo().CenterPane().PaneBorder(false));
manager.Update();


I'd be very grateful for all help!
Last edited by gnschmidt on Mon Oct 02, 2006 7:02 am, edited 1 time in total.
gnschmidt
Registered User
 
Posts: 20
Joined: Sat Sep 30, 2006 2:59 am

Postby Ben on Sun Oct 01, 2006 5:47 am

Hi,

What I think is happening is the following: When the coolbar is hidden, the pane remains visible as far as AUI is concerned. This means that AUI will continue to allocate space for the coolbar because it believes that the coolbar is shown. Basically, the coolbar got hidden without AUI's knowledge.

To solve this, you need to capture the coolbar's hide event, and then lookup the pane info for the coolbar inside aui, then call wxPaneInfo::Show(false) and then wxFrameManager::Update().

Good luck! Let me know if it worked.

All the best,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Postby gnschmidt on Sun Oct 01, 2006 8:02 am

Thanks Ben. I think catching the hide event is not a problem: my coolbar contains two bands (menubar and toolbar) and I'm actively calling ShowBar(1, false) -- it's a method that hasn't yet made it into Martin's coolbar release, though my patch has been with him for a while.

When the user unselects the toolbar menu check item, only part of the coolbar is hidden (i.e. the menubar is still there).

It's this shrinking that a standard wxSizer picks up, but wxFrameManager doesn't. Any idea how I could instruct wxFrameManager to invalidate the rectangle for the coolbar pane and resize accordingly?
gnschmidt
Registered User
 
Posts: 20
Joined: Sat Sep 30, 2006 2:59 am

Postby gnschmidt on Mon Oct 02, 2006 7:01 am

Problem solved! All that is needed is the following:

Code: Select all
manager.DetachPane(coolBar);
manager.Update();
coolBar->ShowBand(1, b);
manager.AddPane(coolBar, wxPaneInfo().Top().CaptionVisible(false));
manager.Update();


Thanks again for your help and for an amazing library!
gnschmidt
Registered User
 
Posts: 20
Joined: Sat Sep 30, 2006 2:59 am

Postby Ben on Thu Oct 05, 2006 7:02 am

Hi,

Great to hear.

All the best,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Return to wxAUI Questions, Thoughts & Feedback