Listbox cellkeydown event not (always) firing in cocoa

Hello anyone who might know what is happening.
I use a listbox to make a hotkey system where the hotkey is entered while a cell is active.
The active cell in carbon works no problem: any key board presses fire the cellkeydown event and I intercept the keypresses to enter whatever text (the hotkey combination) I want into the active cell.
However, in cocoa, any key press that is a keyboard character does not fire the cellkeydown event. The character just ends up in the active cell, no event.
I have return true in the event. In any case, as I say it just does not fire…
Any ideas?
Thanks…

Can anyone verify the same behavior? Maybe it is just my setup?
A listbox with an active cell does not fire cellkeydown event on normal key presses… I believe…
Thanks again…

in cocoa!

[quote=130132:@Theo Cremona]Hello anyone who might know what is happening.
I use a listbox to make a hotkey system where the hotkey is entered while a cell is active.
The active cell in carbon works no problem: any key board presses fire the cellkeydown event and I intercept the keypresses to enter whatever text (the hotkey combination) I want into the active cell.
However, in cocoa, any key press that is a keyboard character does not fire the cellkeydown event. The character just ends up in the active cell, no event.
I have return true in the event. In any case, as I say it just does not fire…
Any ideas?
Thanks…[/quote]

I built a very simple project with a listbox, and in the cellclick event :

me.EditCell(row,column)

So I can make a cell editable, what I believe you call active.

In CellKeyDown :

msgbox str(asc(key)) return true

Actually no character reaches the cell, even when return true is missing. Apparently the msgbox consumes it.

So I could not verify what you describe. Maybe you would be kind enough to post a sample project showing what you describe ?

If you can to use command keys, a much better solution is often to set menu hot keys. It works from any control without special coding, and is more conformant to Apple Human Interface Guidelines.

Thanks so much for looking at that.
I checked by constructing a sample project again, and had the same problem… However, the problem comes not with every key combination. If I press COMMAND and A, for example, instead of an event, I get a letter () typed into the editable cell. In other words, when there is a character made with a modifier key, the event does not fire. (Sorry I was not specific enough earlier.) If you switch the project to Carbon, the event will fire. In cocoa, it does not.
I was not sure what you meant by: “If you can to use command keys, a much better solution is often to set menu hot keys. It works from any control without special coding, and is more conformant to Apple Human Interface Guidelines.”
Thanks so much for your help.

Sorry, I mean OPTION A (). Most characters made with the option key, option S (), etc… type the character into the editable field and don’t fire the event. At least that’s what I get…

[quote=130865:@Theo Cremona]Thanks so much for looking at that.
I checked by constructing a sample project again, and had the same problem… However, the problem comes not with every key combination. If I press COMMAND and A, for example, instead of an event, I get a letter (å) typed into the editable cell. In other words, when there is a character made with a modifier key, the event does not fire. (Sorry I was not specific enough earlier.) If you switch the project to Carbon, the event will fire. In cocoa, it does not.
I was not sure what you meant by: “If you can to use command keys, a much better solution is often to set menu hot keys. It works from any control without special coding, and is more conformant to Apple Human Interface Guidelines.”
Thanks so much for your help.[/quote]

Could you post your test project ?

Wait. Just was able to reproduce the issue. Indeed when the option key is used the Keydown event does not fire.

I see a possible workaround

  • Keep a copy of the last content of the cell from CellTextChange, maybe in CellTag
  • When CellTextChange occurs, check if Cell contains only one character (suspect option key)
  • If Option key character slipped in
    - Inspect the character the same way you would in keydown
    - Restore the previous cell value from CellTag

It is not entirely perfect, though, since you cannot rely on Option-key anymore for regular entries.

Another way would be to rest your hot key system on Keyboard.AsyncKeyDown, Keyboard.Optionkey and so on polled through a timer Action event.

See this <https://xojo.com/issue/28116>

My feeling is I will have to redesign the whole thing based on a timer, as you suggested… Am going to wait a while though and hope that xojo fixes it. (I am assuming it is a bug…)
Thanks again, am glad to discover am not imagining things.

I joined the feedback system and found the case mentioned.
Is there a way of knowing if and when Xojo are going to fix the problem? I would hate to redesign the whole thing for nothing…

[quote=130947:@Theo Cremona]I joined the feedback system and found the case mentioned.
Is there a way of knowing if and when Xojo are going to fix the problem? I would hate to redesign the whole thing for nothing…[/quote]

If I was you I would implement the workaround first. Xojo staff do not give time estimates on bug fixes and the bug report is over one year old. I very much doubt this can be fixed quickly…

Agree.
I’d really need this fix, as others for the Listbox, but I’m not holding the breath.