Fill listbox cells like Excel

Hello,
I create a listbox with 24 rows and two column, the first column has fixed values (label).
The second column must receive values manualy in each cell (24).
Any example about this subject ?

And what do you want to do ?

Emile,
The goal is to enter values in cells instead of textfield, the first Ra column (fixed), the second column perform a task of textfield.

https://documentation.xojo.com/api/deprecated/listbox.html#listbox-columntypeat

1 Like

Do you want to EditCells ?

If so (and tab navigation between Cells), read the documentation (link at this page top-right).

You can also add a Typing Mask, decimal alignment, etc. All explained there:
http://documentation.xojo.com/api/deprecated/listbox.html

MarkusR,
my xojo is 2015r1, so some features does not exist.

then use the API1 with : http://documentation.xojo.com/api/deprecated/listbox.html.ColumnType
make the 2nd column editable that should be enough

Emile,
i run xojo2015r1 a most of features are recent.

I do this code in listbox open event :

Dim i as integer

for i= 0 to 1
LBCompas.ColumnAlignment(i)=LBCompas.AlignCenter
next

Me.columncount=2
Me.columnwidths=“45%,55%”
Me.HasHeading=True
Me.heading(0)=“CC”
Me.heading(1)=“dev”

For i = 0 to 360 step 15
LBCompas.AddRow(format(i,“000”)+“°”)
Next
I need the focus to the dev column to fill.
It looks cdev

should work.

Jean Yves,
I do already LBCompas.ColumnType(1)=ListBox.TypeEditable
It work !
Thank you.

I use the same version.

Do not use a Loop for two lines code !

 LBCompas.ColumnAlignment(0) = LBCompas.AlignCenter
 LBCompas.ColumnAlignment(1) = LBCompas.AlignCenter

The focus is automatic when you set the Cell Editable (at Edit time).

Also: in the preferences, set the Language Reference as LOCAL, so you get the 2015r1 Language Reference (as it was in 2015).

Remember: yu can exclude characters entering from the dev column (a mask set in the Properties pane at design time. ListBox in the LR have details).

If the dev column is set to hours/minutes/seconds (time), a mask can be set… so the user cannot type an alphabetical letter… only digits and : can be entered automatically…

on one line should work too !

Wonderful !
I forgot (probably)…

Very good information using 2015r1.
1)- Two column cells are Hight lighted, i want to keep only the dev column cell.
the left column works as labels.
2- is it possible to get another color ListBox, eg backcolor=black , forecolor (white grid and characters) ?
3)-Your last advice is interesting, usually i use a code to allow only wanted characters.

Do you dislike reading the Language Reference ?

A Row holds Columns (called Cell in code).

DevColumn = LB.Cell(RowNbr,1) // 1 stands for Column #1

“BackColor” and “ForeColor”: this also is in the LR.