Listbox cell alignment not working

I followed the documentation here: ListBox.ColumnAlignmentAt - Xojo Documentation

This is my code: lstBxKids.ColumnAlignmentAt( 0 ) = lstBxKids.Alignments.Center which I put in the lstBxKids.Open Event Handler

These are the errors:
frmKids.lstBxKids.Open, line 21 - Type “Listbox” has no member named “Alignments”
lstBxKids.ColumnAlignmentAt( 0 ) = lstBxKids.Alignments.Center

frmKids.lstBxKids.Open, line 21 - Type “Int32” has no member named “Center”
lstBxKids.ColumnAlignmentAt( 0 ) = lstBxKids.Alignments.Center

frmKids.lstBxKids.Open, line 21 - There is more than one method with this name but this does not match any of the available signatures.
lstBxKids.ColumnAlignmentAt( 0 ) = lstBxKids.Alignments.Center

Try changing that to:

lstBxKids.ColumnAlignmentAt( 0 ) = Listbox.Alignments.Center

What version of Xojo are you using?
Are you using Listbox or DesktopListbox? (check the Super)

XOJO Version 2022 Release 1
Desktop

This is a stand alone app for personal use.

And the recommended change worked! Thanks!

1 Like

Happy to help. If you can, mark my answer as the solution, that will help others if they have the same problem.

If your Listbox has a super of DesktopListbox, then maybe is better to change the line to:

lstBxKids.ColumnAlignmentAt( 0 ) = DesktopListbox.Alignments.Center

Just in case something is changed in the future.

Link to documentation

1 Like