Event when resize has finished?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Event when resize has finished?

Post by JohnD »

I catch OnSize in my top-frame, but it seems to be caught after the main window is resized, but before the rest of the app has been updated. Is there an easy way to be notified after everything has been updated?
Mojo
Super wx Problem Solver
Super wx Problem Solver
Posts: 401
Joined: Wed Sep 21, 2005 8:17 am
Location: Rostov-on-Don, Southern Russia

Re: Event when resize has finished?

Post by Mojo »

JohnD wrote:I catch OnSize in my top-frame, but it seems to be caught after the main window is resized, but before the rest of the app has been updated. Is there an easy way to be notified after everything has been updated?
You can try OnPaint event
Win XP HE SP3, Vista
Xubuntu 12.04 LTS
wxWidgets-2.9.5
wxWidgets-3.0.0
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Re: Event when resize has finished?

Post by JohnD »

I need to know the paint event is because of the resize in that case.
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Event when resize has finished?

Post by doublemax »

There is no event for that. If you want to skip the redraw while the window is still being resized, the only chance is to manually check if the mouse button is down.
Use the source, Luke!
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Re: Event when resize has finished?

Post by JohnD »

It's not specifically during a prolonged resize, even maximizing the window gets this effect... OnSize is called before the layout is updated. I want to evaluate the size of a child control, prompted by the resize, but after everything is recalculated. There's no way to catch this?
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Event when resize has finished?

Post by DavidHart »

Hi,

AFAIK there's no simple way to do that. However you should be able to do it unsimply ;) .

For example, catch (and Skip()) the child control's size event (though you could use the frame's, I suppose). In the handler start a single-shot timer with a reasonable interval e.g. 100ms; you'll need to experiment. Arrange for your recalculation to happen when the timer fires.

As wxTimer::Start stops and restarts a timer, this means that all but the last of multiple size events will be ignored.

Regards,

David
JimFairway
wxWorld Domination!
wxWorld Domination!
Posts: 1059
Joined: Sun Dec 30, 2007 6:40 pm
Location: Canada

Re: Event when resize has finished?

Post by JimFairway »

Hi,

Additionally to David's suggestion, you could catch the wxIdleEvent which is sent after UI activity has settled down.
Check http://docs.wxwidgets.org/stable/wx_wxidleevent.html

Good luck,

Jim
OS: Vista SP1, wxWidgets 2.8.7.
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Re: Event when resize has finished?

Post by JohnD »

JimFairway wrote:Hi,

Additionally to David's suggestion, you could catch the wxIdleEvent which is sent after UI activity has settled down.
Check http://docs.wxwidgets.org/stable/wx_wxidleevent.html

Good luck,

Jim
You reckon the first Idle event after OnSize would be guaranteed to be the one I want?
JimFairway
wxWorld Domination!
wxWorld Domination!
Posts: 1059
Joined: Sun Dec 30, 2007 6:40 pm
Location: Canada

Re: Event when resize has finished?

Post by JimFairway »

Yes, I reckon. The event happens when the main loop has nothing left to do.
Worth a shot.

Jim
OS: Vista SP1, wxWidgets 2.8.7.
Post Reply