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
frame size
-
- CodeLite Curious
- Posts: 8
- Joined: Mon Sep 14, 2015 9:14 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: frame size
Usually, this is done by placing a single panel inside wxFrame and setting size to that wxPanel.
Try this layout:
Eran
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
:
:
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 8
- Joined: Mon Sep 14, 2015 9:14 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: frame size
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
(Just trying to understand the wrinkles of the framework)
Many thanks,
Marcus
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: frame size
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
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
-
- CodeLite Curious
- Posts: 8
- Joined: Mon Sep 14, 2015 9:14 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: frame size
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
I do have another question, for clarity I'll post separately - that's definitely a wxCrafter one.
Thanks again,
Marcus