if programatically moving/resizings windows, must one send move/size events manually?

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
User avatar
Experienced Solver
Experienced Solver
Posts: 70
Joined: Thu May 26, 2016 9:19 pm

if programatically moving/resizings windows, must one send move/size events manually?

Post by bsenftner » Mon Nov 12, 2018 8:36 pm

I have a multi-window application, with the intention of end-users placing windows inside multiple displays attached to the same system. Such users sometimes have rotating displays that switch between portrait and landscape layouts, and users may remove a display between launches of our application.

Our application stores all window locations, and user configurations inside a persistent variable system when the application is quit, with restoring of all window positions and configurations as they were when the application was last quit with each launch.

I am adding logic that determines at launch when a window is being restored to a position no longer visible, due to a monitor rotating or being removed. I can do this repositioning and resizing fine with logic such as this:

Code: Select all

			// how the default window position is calculated when app runs for first time:
			int x, y, w, h;
			wxClientDisplayRect(&x, &y, &w, &h);
			int width = cx_round((cx_real)0.75*(cx_real)w);
			int height = cx_round((cx_real)0.75*(cx_real)h);
			if (height > 915)
				height = 915;	// will only carry forward when a new app config is being created

			int left = (w - width) / 2;
			int top = (h - height) / 2;

			mp_mainframe->SetPosition( wxPoint(left,top) );
			mp_mainframe->SetClientSize( width, height );
However no events are generated. In my window size event handlers I have logic for control layout logic that I want triggered. Do I need to send size and move events manually to insure any related logic I have in event handlers is also executed?

Post Reply