Align wxCrafter controls vertical

Post here wxCrafter related issues / features / bugs
bgining2this
CodeLite Curious
Posts: 4
Joined: Sun Feb 21, 2021 1:46 am
Genuine User: Yes
IDE Question: C++
Contact:

Align wxCrafter controls vertical

Post by bgining2this » Sun Feb 21, 2021 2:38 am

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 !!

DavidGH
CodeLite Plugin
Posts: 702
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Align wxCrafter controls vertical

Post by DavidGH » Sun Feb 21, 2021 3:08 am

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

bgining2this
CodeLite Curious
Posts: 4
Joined: Sun Feb 21, 2021 1:46 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Align wxCrafter controls vertical

Post by bgining2this » Sun Feb 21, 2021 4:05 am

Hi David.-

I think that now i get it, i have also read the this sizer tutorial, it was helpfull. Thank you for everything

bgining2this
CodeLite Curious
Posts: 4
Joined: Sun Feb 21, 2021 1:46 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Align wxCrafter controls vertical

Post by bgining2this » Sun Feb 21, 2021 4:51 am

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

DavidGH
CodeLite Plugin
Posts: 702
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Align wxCrafter controls vertical

Post by DavidGH » Sun Feb 21, 2021 12:04 pm

how do i place horizontal controls besides the controls i have already placed vertically
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.

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 ;) .

Peter H
CodeLite Curious
Posts: 4
Joined: Sun Feb 28, 2021 3:32 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Align wxCrafter controls vertical

Post by Peter H » Sun Feb 28, 2021 3:42 am

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.

DavidGH
CodeLite Plugin
Posts: 702
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Align wxCrafter controls vertical

Post by DavidGH » Sun Feb 28, 2021 12:07 pm

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.
The other advantage is: If the main Window is a GridBagSizer
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.
you can easier re-arrange the controls or add more, if later necessary
Yes, but that is just as true for any other sizer.

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.

Peter H
CodeLite Curious
Posts: 4
Joined: Sun Feb 28, 2021 3:32 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Align wxCrafter controls vertical

Post by Peter H » Sun Feb 28, 2021 8:18 pm

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.

DavidGH
CodeLite Plugin
Posts: 702
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Align wxCrafter controls vertical

Post by DavidGH » Sun Feb 28, 2021 11:46 pm

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.
Exactly! That's why *GridSizers were invented.
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.
Indeed, none has that ability; and, as the saying goes, "It's not a bug, it's a feature".

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.

Peter H
CodeLite Curious
Posts: 4
Joined: Sun Feb 28, 2021 3:32 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Align wxCrafter controls vertical

Post by Peter H » Mon Mar 01, 2021 2:30 pm

DavidGH wrote:
Sun Feb 28, 2021 11:46 pm
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.
Indeed, none has that ability; and, as the saying goes, "It's not a bug, it's a feature".
In this case it is a missing feature. It is just an editing feature that would be compatible with the sizer based design.
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.
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.

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.

Post Reply