Page 1 of 1

frame size

Posted: Tue Sep 15, 2015 11:19 am
by marcusadamski
Hi,

Again just getting to grips with wxCrafter. Given I have a simple frame, vertical boxsizer (containing a text control and within another box sizer some buttons ) - how do I set the size of the initial frame when displayed.?

I've tried setting the frame's Minimum Size and Size with the designer, tried setting the max size of the main box sizer - but when run, the frame appears to always take the smallest size. I also tried to set the frame's size manually after creation in code - but no success. What am I missing?
(using latest wxcrafter, on Linux Mint, with wxpython consuming the XRC)

Thanks for any advice,
Marcus

Re: frame size

Posted: Tue Sep 15, 2015 11:29 am
by eranif
Usually, this is done by placing a single panel inside wxFrame and setting size to that wxPanel.

Try this layout:

Code: Select all

wxFrame  => set size to -1,-1
     wxBoxSizer
          wxPanel (with wxEXPAND|wxALL and border size set to 0) => set size to what your initial size
               wxBoxSizer
                    :
                    :
Eran

Re: frame size

Posted: Wed Sep 16, 2015 10:51 am
by marcusadamski
Thanks Eran - although it feels a bit strange to me, that a panel has to be added to a frame as the root component, in order to control the size. Does this mean the size/min size properties on a frame are redundant?

(Just trying to understand the wrinkles of the framework)

Many thanks,
Marcus

Re: frame size

Posted: Wed Sep 16, 2015 11:01 am
by eranif
Its always a good advise to place a main panel when dealing with wxFrame/wxDialog and place all the controls as child of that panel.
One of the problems is the colour of the wxFrame, try place some buttons on a frame directly and you will notice that the wxFrame has a dark grey background colour which does not fit well with the rest of the controls (this is at least on Windows how it behaves) - this problem is workarounded by using the wxPanel as the main child.

In fact, wxFrame has a special handling for a single wxPanel main child:
You can place a wxPanel without using a sizer on wxFrame and that child will automatically expand and will take all the client area of the wxFrame.

But this is getting off topic and you should post wxWidgets related questions on http://forum.wxwidgets.org

Eran

Re: frame size

Posted: Thu Sep 17, 2015 10:53 am
by marcusadamski
Thanks for your help Eran - it's a fine line between trying to get to grips with wxCrafter and underlying wxWidget issues (especially when I don't know where the issue lies). My apologies if I've posted to the wrong forum.

I do have another question, for clarity I'll post separately - that's definitely a wxCrafter one.

Thanks again,
Marcus