Newb here, still evaluating Xojo for upcoming project.
I’m trying to enable keyboard navigation in a multicolumn ListBox, specifically the Tab and Enter keys. The ListBox.CellKeyDown event’s Key parameter is only returning 0 for Tab, Enter, arrow keys, etc., thus making it (seemingly - I’m probably doing something wrong) impossible to detect which navigation key the user pressed.
What’s the trick to capturing the actual key that the user pressed? Also, I looked, but couldn’t find any example of editing a ListBox “record” like one would with a true data grid in other programming tools like Delphi, .NET WinForms, etc.
Thanks - using ChrB() gets me what I need. But John - I don’t see a KeyPressed event, but it looks like that’s because this I’m working on a OSX desktop app, not a web app.
“Details” is the way WE handles keystrokes. It will probably be back-ported into desktop at some point. The code John posted was web, not desktop. The two hanlde keydown completely different.
Guys, let ask the question another way. Is there some example code or a demo that demonstrates the capturing of all navigation keystrokes in a ListBox for Win/OSX desktop apps?
FUNCTION keydown(key as string) as boolean
SELECT CASE ASCB(key)
case 3,13
''' do what ever the ENTER or RETURN key should do
case 9
''' do what ever the TAB key should do
case 8
''' handle a backspace
case 28
''' handle back arrow
case 29
''' handle right arrow
case 30
''' handle up arrow
case 31
''' handle down arrow
case else
return false ' let OS handle the key, as it is not one you want to handle special
end select
return true ' you handled the key.... OS will ignore it now
END FUNCTION