Page 1 of 1

Listbox captures all keyboard events

Posted: Mon 26 Feb, 2018 17:09
by pepak
Hi!

I would appreciate a little help with a listbox: I have a simple dialog with a listbox and several buttons with DIF_BTNNOCLOSE. The buttons have a hotkey assigned via a caption (e.g. "&Edit" or "&Delete"). If a button has a focus, pressing ALT+E (or even just E) causes a DN_BTNCLICK message for that button to be sent, I can capture it and handle it. However, if the listbox has a focus, neither ALT+E nor E cause the button to be clicked, I have to actually use the mouse (or make the button default, then ENTER would work). What can I do to stop the listbox from capturing these keys and make it pass them on to the buttons? I can make a special test within DN_CONTROLINPUT, but I would rather avoid that as it would make it difficult to e.g. change the hotkey (if ther listbox didn't capture my keys, I could simply change the language string and be done with that).

Testing with FAR3 x86 build 5134.

Pepak

Listbox captures all keyboard events

Posted: Mon 26 Feb, 2018 17:52
by HaRT
I did not write any Far plug-ins but I recollect having read some relevant discussions in the Russian-language part of the forum.
Does your dialog procedure call the default one for the events you don't want to handle in your dialog yourself? If not, that would explain the problem you describe.

Listbox captures all keyboard events

Posted: Mon 26 Feb, 2018 18:01
by pepak
As far as I can tell, yes, I am calling DefDlgProc, except when I want to capture the message myself.

Listbox captures all keyboard events

Posted: Mon 26 Feb, 2018 20:34
by pepak
Yes, I am definitely calling DefDlgProc.

Listbox captures all keyboard events

Posted: Mon 26 Feb, 2018 20:56
by pepak
If I add an edit box to the dialog, activate it (move focus to it) and press ALT+E, the &Edit button gets clicked. That's not true for Listbox, ALT+E gets ignored if that has a focus. Looking through the Encyclopedia to check if there is an option that might be responsible for this behavior, but I can't find one.

A sample binary demonstrating this behavior is attached. Create a new FAR3/x86 directory, create a directory for the plugin, copy the two files. Run FAR, go to Options -> Plugins -> Filters. There you can experiment with ALT+E - works fine when the edit or the buttons are focused, does not work when the listbox is. Some logs are stored into the Filters.dll.log file, e.g. the various DialogProc messages and the indication whether they are passed to DefDlgProc.

Listbox captures all keyboard events

Posted: Mon 26 Feb, 2018 21:15
by HaRT
pepak wrote: Mon 26 Feb, 2018 20:56if there is an option that might be responsible for this behavior
Ah, I bet list-boxes can have their own item hotkeys! So you likely need something to disable these for your list box. I did not see your code though.

Listbox captures all keyboard events

Posted: Mon 26 Feb, 2018 21:22
by pepak
Source code probably wouldn't help as it is a bit too complicated for a casual study.

I am using DIF_LISTNOAMPERSAND and I don't have DIF_LISTAUTOHIGHLIGHT active. I don't think there's any other relevant option.

Listbox captures all keyboard events

Posted: Tue 27 Feb, 2018 07:25
by pepak
After some more testing, I am pretty certain it's a bug in FAR Manager. Bug report submitted to Mantis.
https://bugs.farmanager.com/view.php?id=3586