Align wxCrafter controls vertical
-
- CodeLite Curious
- Posts: 4
- Joined: Sun Feb 21, 2021 1:46 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Align wxCrafter controls vertical
Hello just starting with Codelite and wxCrafter, but i cannot align wxCrafter controls vertically, so when the width of the form ends i am in trouble, i added a vertical wxBoxSizer but i still cant place the controls verticaly only in a line from left to right. Thank you in advance !!
-
- CodeLite Plugin
- Posts: 819
- Joined: Wed Sep 03, 2008 7:26 pm
- Contact:
Re: Align wxCrafter controls vertical
Hi,
Quick answer: add another vertical wxBoxSizer to the top sizer; then add the controls to that.
If that fails, please attach here an archive of your Project, including the .wxcp file.
You might also like to have a look at this sizer tutorial.
Regards,
David
Quick answer: add another vertical wxBoxSizer to the top sizer; then add the controls to that.
If that fails, please attach here an archive of your Project, including the .wxcp file.
You might also like to have a look at this sizer tutorial.
Regards,
David
-
- CodeLite Curious
- Posts: 4
- Joined: Sun Feb 21, 2021 1:46 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Align wxCrafter controls vertical
Hi David.-
I think that now i get it, i have also read the this sizer tutorial, it was helpfull. Thank you for everything
I think that now i get it, i have also read the this sizer tutorial, it was helpfull. Thank you for everything
-
- CodeLite Curious
- Posts: 4
- Joined: Sun Feb 21, 2021 1:46 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Align wxCrafter controls vertical
Hello David.-
Now my problem is horizontal, i have placed all the controls verticaly till the form height is over. My question is how do i place horizontal controls besides the controls i have already placed vertically. Thank you again
Now my problem is horizontal, i have placed all the controls verticaly till the form height is over. My question is how do i place horizontal controls besides the controls i have already placed vertically. Thank you again
-
- CodeLite Plugin
- Posts: 819
- Joined: Wed Sep 03, 2008 7:26 pm
- Contact:
Re: Align wxCrafter controls vertical
The best way to do what you ask is: use a different sort of sizer, a wx<something>GridSizer. See the wxSizer overview. Also build/run/examine the code of the wxWidgets 'layout' sample that comes with the wxWidgets source code.how do i place horizontal controls besides the controls i have already placed vertically
In any case, these are really wxWidgets questions, not CodeLite/wxCrafter ones. If you are creating a project that uses wxWidgets, you need to get to know (at least) the basics of wxWidgets; wxCrafter can only help you create a project, it can't do everything for you .
-
- CodeLite Curious
- Posts: 4
- Joined: Sun Feb 28, 2021 3:32 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Align wxCrafter controls vertical
Hello, I am also a new user, hello to all!
So without guarantee:
Make a panel, put a wxBox Sizer into it and set its orientation to vertical.
This has an additional advantage: The controls inherit the font of the panel. So you can have different fonts, eg for labels and for controls.
The other advantage is: If the main Window is a GridBagSizer, you can easier re-arrange the controls or add more, if later necessary.
So without guarantee:
Make a panel, put a wxBox Sizer into it and set its orientation to vertical.
This has an additional advantage: The controls inherit the font of the panel. So you can have different fonts, eg for labels and for controls.
The other advantage is: If the main Window is a GridBagSizer, you can easier re-arrange the controls or add more, if later necessary.
-
- CodeLite Plugin
- Posts: 819
- Joined: Wed Sep 03, 2008 7:26 pm
- Contact:
Re: Align wxCrafter controls vertical
I agree that a frame or dialog should (almost) always immediately be given a wxPanel as its only child control; then everything else is done inside that panel's sizer system, parented by the panel.
In fact GridBagSizers are not used very often. Of the grid sizers, wxFlexGridSizer is usually the best choice: it makes it easy to create symmetrical rows and columns, which is what you normally want e.g. a narrow column of tick-boxes on the left, each with a wxStaticText with its label in a wider (and stretchable) column on its right.
The only advantage of a wxGridBagSizer is that it can contain and display several different-sized controls in an irregular pattern; which is seldom needed.
You probably meant that to read: "If the main Window's sizer is a GridBagSizer". A sizer is just a layout algorithm, and is not itself a container.The other advantage is: If the main Window is a GridBagSizer
Yes, but that is just as true for any other sizer.you can easier re-arrange the controls or add more, if later necessary
In fact GridBagSizers are not used very often. Of the grid sizers, wxFlexGridSizer is usually the best choice: it makes it easy to create symmetrical rows and columns, which is what you normally want e.g. a narrow column of tick-boxes on the left, each with a wxStaticText with its label in a wider (and stretchable) column on its right.
The only advantage of a wxGridBagSizer is that it can contain and display several different-sized controls in an irregular pattern; which is seldom needed.
-
- CodeLite Curious
- Posts: 4
- Joined: Sun Feb 28, 2021 3:32 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Align wxCrafter controls vertical
Yes, what I meant is: "If the main Window has a GridbagSizer. (My native language is not english and new to this, sometimes I struggle how to say things)
Finally I found, what I initially wanted to do doesnt work: Place static controls and active controls (e.g. wxTextCtrl) into different panels.
It is possible but the controls do not align.
So, there should be a method to select many controls by Ctrl-Click and edit their parameters together. (It is done this way in Delphi and Freepascal/Lazarus).
This would be a great improvement and speed up the editing.
I have now tried wxCrafter, wxFormbuilder, DialogBlocks and wxSmith, but none has this ability.
Finally I found, what I initially wanted to do doesnt work: Place static controls and active controls (e.g. wxTextCtrl) into different panels.
It is possible but the controls do not align.
So, there should be a method to select many controls by Ctrl-Click and edit their parameters together. (It is done this way in Delphi and Freepascal/Lazarus).
This would be a great improvement and speed up the editing.
I have now tried wxCrafter, wxFormbuilder, DialogBlocks and wxSmith, but none has this ability.
-
- CodeLite Plugin
- Posts: 819
- Joined: Wed Sep 03, 2008 7:26 pm
- Contact:
Re: Align wxCrafter controls vertical
Exactly! That's why *GridSizers were invented.Finally I found, what I initially wanted to do doesnt work: Place static controls and active controls (e.g. wxTextCtrl) into different panels. It is possible but the controls do not align.
Indeed, none has that ability; and, as the saying goes, "It's not a bug, it's a feature".So, there should be a method to select many controls by Ctrl-Click and edit their parameters together. (It is done this way in Delphi and Freepascal/Lazarus). This would be a great improvement and speed up the editing.
I have now tried wxCrafter, wxFormbuilder, DialogBlocks and wxSmith, but none has this ability.
Those form designers are meant for creating wxWidgets programs. wxWidgets' sizer system lets you avoid the disadvantages of absolute positioning e.g. they painlessly cope with a change of font-size or locale.
-
- CodeLite Curious
- Posts: 4
- Joined: Sun Feb 28, 2021 3:32 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Align wxCrafter controls vertical
In this case it is a missing feature. It is just an editing feature that would be compatible with the sizer based design.DavidGH wrote: ↑Sun Feb 28, 2021 11:46 pmIndeed, none has that ability; and, as the saying goes, "It's not a bug, it's a feature".So, there should be a method to select many controls by Ctrl-Click and edit their parameters together. (It is done this way in Delphi and Freepascal/Lazarus). This would be a great improvement and speed up the editing.
I have now tried wxCrafter, wxFormbuilder, DialogBlocks and wxSmith, but none has this ability.
To be fair, one must admit, in Freepascal/Delphi there is relative positioning. Controls or panels are "anchored" to relative window positions or to other controls and there are font dependent mechanisms to take care of font size or of High DPI displays.Those form designers are meant for creating wxWidgets programs. wxWidgets' sizer system lets you avoid the disadvantages of absolute positioning e.g. they painlessly cope with a change of font-size or locale.
I have also tried "Ultimate++", they use fontsized coordinates and a system of solid and elastic spacers, which is MUCH more intuitive and flexible. They also have this Ctrl click feature to edit many controls simultaniously. (I dont use it, because they use an own package and documentation systen, that binds you to their IDE, build system and "NTL" which replaces the STL.)
I dont use Delphi/Freepascal, because I want C++, not Pascal.