Resty_Cena
(Resty Cena)
February 5, 2024, 6:48am
1
I’m trying to display a record set in vertical arrangement in a DeskTopListbox. The first column contains field labels, one for each row, and the second column contains the corresponding values of the field. I’d like to right-align the labels within their column. For example:
Blockquote
one 1
two 2
three 3
seven 7
How may this be coded in Xojo?
Thanks.
Resty_Cena
(Resty Cena)
February 5, 2024, 6:49am
2
Sorry, the labels one, two, three, seven should be right-aligned in my example.
Maybe you find the documentation helpfull: Desktoplistbox.ColumnAlignmentAt()
ListBox1.ColumnAlignmentAt(1) = DesktopListBox.Alignments.Right
1 Like
Sascha_S
(Sascha S)
February 5, 2024, 9:29am
5
Like @Thomas_Roemert wrote. It’s easy and it’s documented.
BTW: You can “design” Tables in this Forum using Markdown.
| Right Aligned | Standard/Left Aligned |
| -----------: | ----------- |
| one | 1 |
| two | 2 |
| three | 3 |
| seven | 7 |
becomes
Right Aligned
Standard/Left Aligned
one
1
two
2
three
3
seven
7
3 Likes
Sascha_S
(Sascha S)
February 5, 2024, 10:47am
6
Try this in the Open Event of a DesktopListBox:
Me.ColumnCount = 3
Me.ColumnWidths = "*,60,60"
Me.ColumnAlignmentAt(0) = DesktopListBox.Alignments.Right
Me.ColumnAlignmentAt(1) = DesktopListBox.Alignments.Left
Me.ColumnAlignmentAt(2) = DesktopListBox.Alignments.Decimal
Me.ColumnAlignmentOffsetAt(2) = -24
Me.HeaderAt(0) = "Verbal"
Me.HeaderAt(1) = "Whole"
Me.HeaderAt(2) = "Decimal"
Me.AddRow "One", "1", "1,00"
Me.AddRow "Two", "2", "2,00"
Me.AddRow "Three Point Five Two", "3,52", Format(3.52,"#.##") // Using Format to be International savy
Me.AddRow "Seven", "7", "7,00"
Me.AddRow "Twelve", "12", "12,00"
and it will look like this:
Is this what you are looking for?
2 Likes
Resty_Cena
(Resty Cena)
February 5, 2024, 5:22pm
7
Yes! Thank you, thank you.
1 Like