Label, Text input, alignment
-
@kl3m3n Hi!
It only works when the label texts have the same length, like in your example.
Try it with different text lengths.Regards,
Denes -
@DenesL Hi.
What about the second example? Creating background as a separate widget?
@kl3m3n said in Label, Text input, alignment:
"|BSR UID:bg1 X:50 Y:20 W:50 H:5 BTH:0\r\n"
"|BSR UID:bg2 X:50 Y:26 W:50 H:5 BTH:0\r\n"
"|BSR UID:bg3 X:50 Y:32 W:50 H:5 BTH:0\r\n"
"|LB UID:lb1 X:25 Y:20 TXT:"My label 1" ALP:1\r\n"
"|LB UID:lb2 X:25 Y:26 TXT:"My label 2" ALP:1\r\n"
"|LB UID:lb3 X:25 Y:32 TXT:"My label 3" ALP:1\r\n"P. S.: I will update the designer tool, thank you for the reminder.
Best regards,
kl3m3n -
@kl3m3n Hi!
Nope.The problem is that ALP 1 aligns the text to the left of the center point i.e. the text ends at the center point, so the texts only seem to left align when they all have equal length (using monospaced fonts).
You would have to do a lot of trial an error positioning for each widget to get all texts to appear to line up on the left while ending at a different center point. And then reposition the background boxes too. Same issue with any other ALP value.
I hope I am being clear. I believe things look better when aligned, either on the left edge or the right one (same issue, just on the other side of the center point).
Regards,
Denes -
@DenesL Hi!
Ok, I understand now. I will see what I can do about this. I will let you know once I've fixed this!
Best regards,
kl3m3n -
@DenesL Hi.
To keep backwards compatibility, I have introduced a new parameter for label widget ("LALP", label alignment position), which specifies the text alignment within the background.
I have set a fixed background and different text lengths with label alignment to the left side of the background (LALP:1). The X origin is determined by the X and ALP parameter.
|LB UID:lb1 X:5 Y:30 TXT:"The quick brown" ALP:1 BGC:#00ff00 W:80 LALP:1 |LB UID:lb2 X:5 Y:34 TXT:"The quick brown fox jumps" ALP:1 W:80 LALP:1 BGC:#00ff00 |LB UID:lb3 X:5 Y:38 TXT:"The quick brown fox jumps over the" ALP:1 W:80 LALP:1 BGC:#00ff00
The result:
If I right-align the label (LALP:2):
And center align the label (LALP:0):
I must also update the GUI-O designer and developer manual to better explain ALP (and its relevance with X position). ALP actually changes the X origin point (left, right, center of the widget).
It is a bit more complicated now, but does not break previous code.
I will also replace the ALP parameter for TI and NI widgets with LALP as this seems more consistent with the new scenario.
What do you think?
Best regards,
kl3m3n -
@kl3m3n Hi!
It sounds like a good solution but when I tried to test it I got:Invalid component parameter LALP (lb3)
running gui-o 1.0.40
Regards,
Denes -
@DenesL Yes, I have not released the fix yet. I wanted to get your opinion first.
I will create a new release today (with some other minor patches).
Regards,
kl3m3n -
@kl3m3n Hi!
I noticed gui-o version 1.0.41 is out, does it contain the fixes?Regards,
Denes -
@DenesL Yes!
BR,
kl3m3n -
@kl3m3n Hi!
It works like a charm!
Thanks,
Denes -
@kl3m3n Hi!
It occurred to me last night, can you have ALP 3 and 4 instead of LALP 1 and 2?. Simpler?.Regards,
Denes -
@DenesL I would like to keep ALP values (and consistency) reserved for future use (maybe vertical alignment, etc.).
Thanks for the suggestion though.
Regards,
kl3m3n