wxControls placement

Post here wxCrafter related issues / features / bugs
Massimo Manca
CodeLite Curious
Posts: 3
Joined: Sat Aug 10, 2013 10:59 am
Genuine User: Yes
IDE Question: C++
Contact:

wxControls placement

Post by Massimo Manca » Sat Aug 10, 2013 11:03 am

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?

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

Re: wxControls placement

Post by eranif » Sat Aug 10, 2013 11:22 am

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:

Code: Select all

wxPanel 
   ->  wxBoxSizer (orientation set to horizontal) 
        -> checkbox 
        -> checkbox 
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
Make sure you have read the HOW TO POST thread

Massimo Manca
CodeLite Curious
Posts: 3
Joined: Sat Aug 10, 2013 10:59 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: wxControls placement

Post by Massimo Manca » Sun Aug 11, 2013 12:29 pm

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

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

Re: wxControls placement

Post by eranif » Sun Aug 11, 2013 2:31 pm

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:
wxc1.png
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

Massimo Manca
CodeLite Curious
Posts: 3
Joined: Sat Aug 10, 2013 10:59 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: wxControls placement

Post by Massimo Manca » Mon Aug 12, 2013 12:59 pm

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.

Post Reply