Page 1 of 1

How to right-align TextGadgets in Form Designer?

Posted: Sun May 13, 2018 9:20 pm
by RobertSF
The designer doesn't use actual controls but instead draws the gadgets on the screen. I understand the design decision -- PureBasic is multi-platform, but each platform has its own controls. However, since the designer's font and the actual control font when running are not the same font, this makes gadget alignment difficult. It's not a problem with gadgets that are aligned on their left side, but it's an issue with field labels, which are often aligned on the right, like this:

Image

I realized that if you adjust the gadget positions by hand until they line up, that only means they will line up under the platform you're working on (Windows in this case). On a different platform, they will again be out of alignment.

I suppose one option is not to align fields labels on the right. Any other ideas?

Re: How do you handle this quirk in the designer?

Posted: Sun May 13, 2018 9:38 pm
by TI-994A
RobertSF wrote:...it's an issue with field labels, which are often aligned on the right...
One workaround would be to create the labels with equal widths, align them, then use the #PB_Text_Right flag to align the text to the right.

How to right-align TextGadgets in Form Designer?

Posted: Mon May 14, 2018 2:55 am
by RobertSF
OMG, that was so easy! I must have had a brain burp. Anyway, in case it helps someone else, here's the full how-to.

You can't align gadgets on their right side, but if you need some right-justified field labels, start by making them all as large as the largest one. Align them on their left sides. Then check the box for #PB_Text_Right Constant on each gadget. It's at the bottom of the list of gadget properties. Now they will be nicely right-aligned!