~wxRESIZE_BORDER not working on Mac OS (frame still sizable) Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
BenKissBox
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu Jan 30, 2020 2:22 pm
Location: France / Netherlands

~wxRESIZE_BORDER not working on Mac OS (frame still sizable)

Post by BenKissBox » Tue Jul 07, 2020 8:08 pm

Hello everybody,

I am facing a strange issue for an wxWidgets application I ported on Mac OS. The main frame is created using the following style

Code: Select all

frame->SetWindowStyle (wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX));
as recommended from here
https://docs.wxwidgets.org/stable/classwx_frame.html

The Windows version works as expected : the frame can not be resized if I try to drag one of the corner. But on Mac OS (I am on 10.13 using XCode 9), the frame remains sizeable. I am able to resize it by dragging the corners.

Is there a specific way to make non-resizable frames on Mac OS ?

Thanks

Benoit

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

Re: ~wxRESIZE_BORDER not working on Mac OS (frame still sizable)

Post by doublemax » Tue Jul 07, 2020 9:38 pm

Code: Select all

frame->SetWindowStyle (wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX));
When do you call this? Not all window styles can be changed after the window has already been fully created (this can also be platform dependent). Try passing these flags to the constructor.
Use the source, Luke!

BenKissBox
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu Jan 30, 2020 2:22 pm
Location: France / Netherlands

Re: ~wxRESIZE_BORDER not working on Mac OS (frame still sizable)

Post by BenKissBox » Wed Jul 08, 2020 5:11 am

doublemax wrote:
Tue Jul 07, 2020 9:38 pm

Code: Select all

frame->SetWindowStyle (wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX));
When do you call this? Not all window styles can be changed after the window has already been fully created (this can also be platform dependent). Try passing these flags to the constructor.
Hi Max,

yep, you got it again :D

I was calling the method just after the wxFrame instantation in the application constructor. result : it fails
I made another test by moving call of the SetWindowStyle in the wxFrame constructor itself. Same result.

But when I pass the parameters to the parent constructor like below, it works

Code: Select all

MyFrame::MyFrame (const wxString& title) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, (wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX))
I was convinced that calling it in the herited constructor would give the same result, but yes, apparently, some frame characteristics can not be changed once the frame is created.

Thanks for the help

Benoit

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4258
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ~wxRESIZE_BORDER not working on Mac OS (frame still sizable)

Post by ONEEYEMAN » Wed Jul 08, 2020 5:02 pm

Hi,
I believe this is documented somewhere...

Thank you.

Post Reply