frame size

Post here wxCrafter related issues / features / bugs
marcusadamski
CodeLite Curious
Posts: 8
Joined: Mon Sep 14, 2015 9:14 pm
Genuine User: Yes
IDE Question: c++
Contact:

frame size

Post by marcusadamski » Tue Sep 15, 2015 11:19 am

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

User avatar
eranif
CodeLite Plugin
Posts: 6089
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: frame size

Post by eranif » Tue Sep 15, 2015 11:29 am

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
Make sure you have read the HOW TO POST thread

marcusadamski
CodeLite Curious
Posts: 8
Joined: Mon Sep 14, 2015 9:14 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: frame size

Post by marcusadamski » Wed Sep 16, 2015 10:51 am

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

User avatar
eranif
CodeLite Plugin
Posts: 6089
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: frame size

Post by eranif » Wed Sep 16, 2015 11:01 am

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
Make sure you have read the HOW TO POST thread

marcusadamski
CodeLite Curious
Posts: 8
Joined: Mon Sep 14, 2015 9:14 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: frame size

Post by marcusadamski » Thu Sep 17, 2015 10:53 am

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

Post Reply