Programatically set/unset top-window resizing Topic is solved

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

Programatically set/unset top-window resizing

Post by JohnD » Thu Mar 01, 2012 8:50 am

My app normally allows the user to resize the main window, but in one circumstance I want to disable this (we're doing video recording and changing the size of what's being copied would mess things up). Is it possible to do so in a simple programatic way?

User avatar
doublemax
Moderator
Moderator
Posts: 15267
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Programatically set/unset top-window resizing

Post by doublemax » Thu Mar 01, 2012 10:46 am

Code: Select all

long oldstyle = GetWindowStyleFlag();

// to enable resizing:
SetWindowStyleFlag( oldstyle | wxRESIZE_BORDER );

// disable
SetWindowStyleFlag( oldstyle &~ wxRESIZE_BORDER );
This works at least under MSW. Changing window style flags at runtime may not work for all flags and/or on all platforms.
Use the source, Luke!

Anil8753
Experienced Solver
Experienced Solver
Posts: 92
Joined: Sat Jan 16, 2016 5:57 am
Location: India

Re: Programatically set/unset top-window resizing

Post by Anil8753 » Mon Jan 09, 2017 3:58 am

You are correct doublemax, It is not working under Mac OS. Could you advise me how to achieve under Mac as well.

User avatar
doublemax
Moderator
Moderator
Posts: 15267
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Programatically set/unset top-window resizing

Post by doublemax » Mon Jan 09, 2017 6:20 am

I don't work under OSX, but if it doesn't work there, you only have two options:

a) recreate the whole frame with the new flags

b) research if it's possible at all under OS X using native code

And just for the record: In 99.9% of all cases i would consider this behavior bad UI design. Which might also be the reason why it's not possible under OS X which has very strict UI guidelines.
Use the source, Luke!

Post Reply