Listbox vs. other control hotkeys

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 vs. other control hotkeys

Post by pepak »

I am trying to fix a bug in my Filters plugin: When I open the plugin's configuration, I cannot use default keyboard shortcuts on buttons (e.g. ALT+N or N for New Filter) as long as the listbox is focused. I can do it if I specifically capture the DN_CONTROLINPUT message, but that is only really feasible for custom shortcuts (e.g. INSERT for New Filter), not for the default ones - because the default ones can be user-controlled by modifying the language file (e.g. if I capture ALT+N and the user changes "&New" to "Ne&w", typically while translating the plugin). Can this behavior be somehow overcome, i.e. can I force Listbox to ignore keys other than the cursor movement and pass them on to the rest of the dialog? I would have thought that not using DIF_LISTNOAMPERSAND would solve the problem, but apparently that is not the case.
User avatar
citRiks
Posts: 1733
Joined: Fri 25 Oct, 2019 18:18
Has thanked: 610 times
Been thanked: 102 times

Listbox vs. other control hotkeys

Post by citRiks »

pepak
@XeRoX wrote:Interesting. For sure you can invent some macros for that, catching input on listbox, analyzing is it any hotkey combination, and if it is, probably moving the focus out of ListBox, applying the key combination, then finally moving focus back to the List/Combo.
Or somehow directly set the dialog control value upon receiving in List/ComboBox hotkey combination for it
Last edited by citRiks on Mon 16 Mar, 2020 14:07, edited 2 times in total.
User avatar
citRiks
Posts: 1733
Joined: Fri 25 Oct, 2019 18:18
Has thanked: 610 times
Been thanked: 102 times

Listbox vs. other control hotkeys

Post by citRiks »

I would also recommend translate your post in russian and post it in relevant russian forum,
there is much more active developers, than in entire other non-russian together, sad, bad true :)
Shmuel
Posts: 6820
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times

Listbox vs. other control hotkeys

Post by Shmuel »

citRiks wrote: Mon 16 Mar, 2020 14:25 there is much more active developers, than in entire other non-russian together
99% of active developers in Far Manager field know English so there's absolutely no problem with that.
User avatar
citRiks
Posts: 1733
Joined: Fri 25 Oct, 2019 18:18
Has thanked: 610 times
Been thanked: 102 times

Listbox vs. other control hotkeys

Post by citRiks »

Shmuel, probably you right
can you say something about @XeRoX's suggestion?
PS
Is there probably something like dlg.GetHotKeys() fetching all the defined hotkeys dialog-wide?
Shmuel
Posts: 6820
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times

Listbox vs. other control hotkeys

Post by Shmuel »

citRiks wrote: Mon 16 Mar, 2020 14:50 can you say something about @XeRoX's suggestion?
Is there probably something like dlg.GetHotKeys() fetching all the defined hotkeys dialog-wide?
I think there is some deficiency in Far ListBox features that can be solved in Far itself.
User avatar
citRiks
Posts: 1733
Joined: Fri 25 Oct, 2019 18:18
Has thanked: 610 times
Been thanked: 102 times

Listbox vs. other control hotkeys

Post by citRiks »

Shmuel,
do you think it makes sense to open feature request, and which?
the consideration to decide about and interesting to know as well,
is it easy for FAR group implement the missing parts?
and which missing parts exactly?

technically in Lua script, upon dialog initializing,
you may as well go thru all the dialog element,
find all "&" in it, and so you have all Alt+<*> hotkeys in "generic" way.
And further In the input(key( event catcher you may relate "Alt+<*>" to corresponding element

I personally think there is no hope somebody of FAR developers will do any steps to improve the API here,
so the only hope is as me or @XeRoX suggested, andto say honestly,
it does not seem to be very hard for experienced Lua FAR programmer as Pepak seems to be
Shmuel
Posts: 6820
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times

Listbox vs. other control hotkeys

Post by Shmuel »

citRiks, those who understand do not ask but just open a request.
I really do not have any time now to deal with this issue.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Listbox vs. other control hotkeys

Post by pepak »

citRiks wrote: Mon 16 Mar, 2020 14:05 pepak
@XeRoX wrote:Interesting. For sure you can invent some macros for that, catching input on listbox, analyzing is it any hotkey combination, and if it is, probably moving the focus out of ListBox, applying the key combination, then finally moving focus back to the List/Combo.
Or somehow directly set the dialog control value upon receiving in List/ComboBox hotkey combination for it
That is certainly a possibility which would resolve my immediate problem, but as far as I am concerned, it would be a very bad idea. This should be handled by Listbox, not some workarounds. I mean, if we are going this way, why not ignore FAR's Dialog API completely and draw by working directly with the console? After all, in DN_CONTROLINPUT there's no need for Listbox to handle anything else than the cursor movement, it can just as well leave any other keys to the default handling. Or, if there is a need, why not add a new flag which would reduce the keyboard processing to the bare minimum? In fact, it would be quite sufficient if I could send the message data from DN_CONTROLINPUT to the rest of the dialog...
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Listbox vs. other control hotkeys

Post by pepak »

Shmuel wrote: Mon 16 Mar, 2020 16:47 citRiks, those who understand do not ask but just open a request.
I really do not have any time now to deal with this issue.
I am afraid my experience with opening requests does not fill me with optimism. These days, I generally modify my build of FAR and leave the changes private because it seems pointless to write requests, even requests asking for my code to be added to FAR's codebase :-(.
User avatar
HaRT
Moderator
Posts: 10823
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 221 times
Been thanked: 358 times

Listbox vs. other control hotkeys

Post by HaRT »

pepak wrote: Mon 16 Mar, 2020 18:18 it seems pointless to write requests, even requests asking for my code to be added to FAR's codebase
Creating a Pull Request at GitHub is not complicated, but you'd better discuss the proposed changes with FAR maintainers here at the forum first and should be prepared for a thorough peer review of your code before the PR gets accepted.
Фар есть инструмент, а не нянька. © 2009 DrKnS
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Listbox vs. other control hotkeys

Post by pepak »

I will need to do some testing, but it seems to me that extending the condition on line 2896 in dialog.cpp with something along the lines of "and no keyboard modifiers are pressed and DIF_LISTNOAMPERSAND is present" would do the trick.

Note to self: search for the second occurrence of:

Code: Select all

if (Items[m_FocusPos].Type == DI_LISTBOX)
and experiment with that.
Last edited by pepak on Mon 16 Mar, 2020 18:38, edited 1 time in total.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Listbox vs. other control hotkeys

Post by pepak »

HaRT wrote: Mon 16 Mar, 2020 18:21
pepak wrote: Mon 16 Mar, 2020 18:18 it seems pointless to write requests, even requests asking for my code to be added to FAR's codebase
Creating a Pull Request at GitHub is not complicated, but you'd better discuss the proposed changes with FAR maintainers here at the forum first and should be prepared for a thorough peer review of your code before the PR gets accepted.
Sorry, I have pretty much given up trying to contribute already. It seems impossible to get any kind of reaction to code proposals, even if it should be "we don't want it because you are too ugly". :-((
User avatar
citRiks
Posts: 1733
Joined: Fri 25 Oct, 2019 18:18
Has thanked: 610 times
Been thanked: 102 times

Listbox vs. other control hotkeys

Post by citRiks »

@Pepak opened bug request, unportunately got zero response

"Listbox captures all keyboard events"
viewtopic.php?f=41&t=11099
https://bugs.farmanager.com/view.php?id=3586

Developers are too busy with other stuff, we know,
and naturally regular people like us are not willing make those developer's lives even worse
Post Reply

Return to “Plug-In Developers”