Tab Key in Listbox

I like to jump btween de columns in a listbox, also between different types og columns, some with a Edit function and some with e Menu function.
Kow to do

And you do not found clues in the LR ?

Check the Determining which cell was double-clicked and Making a Cell Editable.

In Key Event, you can put code to trap the Tab key (but not only it) an go from Column 0 to the last column (and Back if you press the shift key and code it that way)

I don’ understand.
The only thing what i need is the posebility to jump, in a listbox, with the TAB key fpr a editeble coolumn to a column with a Menu.
But i can’t find a setfocus event into a listbox.
Maybe there is a Tutorial?

The link I provide is to the Listbox Language Reference page.

The two terms in Bold are entries located near the top of that page.

Other entry related is: auto-advance-in-listbox .

I wrote earlier: [quote=366987:@Emile Schwarz]In Key Event[/quote]. If you do not understand that, clearly express yourself.

Like everyone in this forum, I once was a beginner.

Use the code to set the Listbox in Cell Editable mode (read the doc).
In Xojo IDE, add a CellKeyDown Event.
You will get Key as string as the Event parameter.

If Key = Chr(9) Then Beep // So you know it works, then replace Beep with real code End if

From there, you have to set the next Column, replace Beep with Me.EditCell(Row, Column+1) for example to go to the next Column.

OK, to jump to a editble Cell is not the problem, but from a editble cell to a Not editble Cell, thats the problem.
Or to jump from a Not editble Cell, fot Instance, a column with a Menu or a event like ConstructContextualMenu

IMHO: not possible ! Do you want to select a Cell WITHOUT EDITING IT ? If so, search in the Forum or create a new conversation with “How do I select a Listbox Cell ?”

First of all, I do not know what is a Not editable Cell.

What is that ? Applying something to a Column is a different story.

You have an example in the documentation.

Please, write better explanations.

BTW: did you checked the provided examples (in the Example Projects folder). There are 12 examples with Listbox in their names in the Example Projects folder of Xojo 2017r3.

PS: you can use if writing in English is not easy for you.

don’t forget you can’t select only a cell in a listbox, but a whole row (or many rows)
so first you have to make a subclass of listbox that can select only one cell
then depending on how you implement it, then you will then implement a navigation with arrow keys and tab key.

hint: you will use the cellbackgroundpaint event to paint the back of the selected cell.

Wrong: you can do that using a simple click in a cell.

Here’s a screen shot:

The selected cell is the R letter.

Edit: Since this is just a proof of concept, I do not centered horizontally the letters in the Listbox Columns / Cells.

this is not a standard “out of the box” listbox, you wrote events (like cellbackgroundpaint…)
in a standard listbox, you can only select one or more row(s), not a cell.

It is the built-in Listbox. I do not recall the code, but I do not do fancy stuff. I will check it later.

Obviously, I also use CellTextPaint to set the selected Cell (letter) in blue.

Now if you consider there is no Cell selection like Row selection as non standard, you are right. But in that case, Xojo is poor, very poor and not worth its price.

Note: My Xojo is not rich.
(if you consider all the missing bits…)

I just get an eye in my code: I do not even subclass the Listbox. I have two Properties (gRow and gColumn) and put code in these Listbox Events:

CellBackgroundPaint, CellClick CellTextPaint, KeyDown Open

That gives 111 lines (including comments and empty lines) / 2,895 Chars :wink:
I do not even searched to be compact / fine tune the code (nor reviewed the code before getting these statistics).

so for me it’s not the standard listbox … you can also make a subclass, it will be easier to reuse it later on multiple apps.

OK / Yes.