Easily starting a window maximized, and keeping it that way (Win7)

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
darlingm
In need of some credit
In need of some credit
Posts: 7
Joined: Sat Apr 11, 2015 7:27 pm

Easily starting a window maximized, and keeping it that way (Win7)

Post by darlingm » Wed Apr 22, 2015 3:08 am

On Windows 7, if I:
* Create a wxFrame with style "wxDEFAULT_FRAME_STYLE & ~wxMAXIMIZE_BOX & ~wxRESIZE_BORDER" (~ inverts bits, so removes these from the default)
* Call Maximize()
* Call Show()

As expected, the frame starts maximized, with the maximize box grayed out. However, double clicking or dragging the title bar resizes the window back to wxDefaultSize. (Then, it's stuck that size, with no way to get it back maximized.)

Is there a way to force the window to start and stay maximized? (With the option of being minimized still.) Short of determining which monitor windows start on by default, and setting the size in the wxFrame constructor to that monitor's display resolution.

A "wxMaximumSize" might do the trick, to pass to the wxFrame constructor.

Or, a way to disable anything happening on title bar double clicking or dragging.

User avatar
tierra
Site Admin
Site Admin
Posts: 1343
Joined: Sun Aug 29, 2004 7:14 pm
Location: Salt Lake City, Utah, USA
Contact:

Re: Easily starting a window maximized, and keeping it that way (Win7)

Post by tierra » Wed Apr 22, 2015 6:38 am

It's a pretty rare request since it very likely makes for a frustrating UI for users for mostly no benefit. I'm actually kind of surprised to even see that combination of style flags being mentioned in the manual.

I'm not sure if what you have in mind is actually possible, but you might be able to do it another way altogether by actually using the fullscreen functionality with wxTopLevelWindow::ShowFullScreen()

Post Reply