Listbox captures all keyboard events

A place where plug-in developers can share their knowledge and experience.
Post Reply
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Listbox captures all keyboard events

Post 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
User avatar
HaRT
Moderator
Posts: 10822
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 221 times
Been thanked: 358 times

Listbox captures all keyboard events

Post 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.
Фар есть инструмент, а не нянька. © 2009 DrKnS
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Listbox captures all keyboard events

Post by pepak »

As far as I can tell, yes, I am calling DefDlgProc, except when I want to capture the message myself.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Listbox captures all keyboard events

Post by pepak »

Yes, I am definitely calling DefDlgProc.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Listbox captures all keyboard events

Post 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.
Attachments
sample-bin.zip
(256.16 KiB) Downloaded 162 times
User avatar
HaRT
Moderator
Posts: 10822
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 221 times
Been thanked: 358 times

Listbox captures all keyboard events

Post 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.
Фар есть инструмент, а не нянька. © 2009 DrKnS
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Listbox captures all keyboard events

Post 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.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Listbox captures all keyboard events

Post 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
Post Reply

Return to “Plug-In Developers”