wxControls placement
-
- CodeLite Curious
- Posts: 3
- Joined: Sat Aug 10, 2013 10:59 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
wxControls placement
Probably will seem a stupid question but I am not able to place freely the controls as I want. For instance I want to have 2 vertical check box arrays inside 2 panels but I am able only to put the 1st one because the 2nd will be put under the 1st instead then on its right. I would like to understand how I can freely put controls on a dialog just moving them with the mouse. Is it possible?
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: wxControls placement
wxCrafter offers controls placement using sizers. This is the wxWidgets way.
To place 2 checkboxes next to each other, you need to have this hirerchy:
You should read some about wxWidgets sizers, there is tutorial here:
http://hosannahighertech.co.tz/forums/s ... php?tid=74
But in general, try playing around with sizers in wxCrafter and see the result
Basically, controls are placed inside wxSizers and never directly inside a parent
Eran
To place 2 checkboxes next to each other, you need to have this hirerchy:
Code: Select all
wxPanel
-> wxBoxSizer (orientation set to horizontal)
-> checkbox
-> checkbox
http://hosannahighertech.co.tz/forums/s ... php?tid=74
But in general, try playing around with sizers in wxCrafter and see the result
Basically, controls are placed inside wxSizers and never directly inside a parent
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 3
- Joined: Sat Aug 10, 2013 10:59 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: wxControls placement
I am able to do this. What I am not able to do is to have 2 separate panels one with 16 check boxes vertically oriented and another panel with 8 spin controls always vertically oriented. The 1st panel should be at the left of the second side by side.
The panels should be side by side so the 1st should be on left of the 2nd.
When I place more then 1 panel or more then 1 sizer the 2nd always is under the 1st (so it is vertically ordered) and not on the side.
Actually my hierarchy is this:
MainDialog
+---mainSizer
+---spacer
+---panelLeft
+---boxSizer
+---chkBox1
+---chkBox2
...
+---chkBox8
+---panelRight
+---boxSizer
+---spinBox1
+---spinBox2
...
+---spinBox8
+---staticLine
+---boxSizer
+---btnOk
+---btnCancel
The panels should be side by side so the 1st should be on left of the 2nd.
When I place more then 1 panel or more then 1 sizer the 2nd always is under the 1st (so it is vertically ordered) and not on the side.
Actually my hierarchy is this:
MainDialog
+---mainSizer
+---spacer
+---panelLeft
+---boxSizer
+---chkBox1
+---chkBox2
...
+---chkBox8
+---panelRight
+---boxSizer
+---spinBox1
+---spinBox2
...
+---spinBox8
+---staticLine
+---boxSizer
+---btnOk
+---btnCancel
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: wxControls placement
Maybe I am missing it, but:
- The only children of the mainSizer should be panelLeft and panelRight
- mainSizer should have orientation of "wxHORIZONTAL"
Look at the below screenshot to see how it should look like. Notice the orientation of the sizer is set to wxHORIZONTAL:
Eran
- The only children of the mainSizer should be panelLeft and panelRight
- mainSizer should have orientation of "wxHORIZONTAL"
Look at the below screenshot to see how it should look like. Notice the orientation of the sizer is set to wxHORIZONTAL:
Eran
You do not have the required permissions to view the files attached to this post.
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 3
- Joined: Sat Aug 10, 2013 10:59 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: wxControls placement
Yes, it is what I want. I am not used with sizers, I think it is my main difficulty. I am more used with C++ Builder and Qt.
Thanks, I will correct my project as you described.
Thanks, I will correct my project as you described.