purebasic icon indicating copy to clipboard operation
purebasic copied to clipboard

Allow Enter key to open selected Project File in list

Open kenmo-pb opened this issue 2 years ago • 6 comments

In the Project tab > Project Files list, you can double-click a project file to open it (or switch to it).

This PR adds the same action if you press the Enter key, useful when navigating the list by keyboard.

In fact the action is directly copied from the #PB_EventType_LeftDoubleClick handler in MainWindowEvents().

kenmo-pb avatar Jul 29 '21 02:07 kenmo-pb

Works ok on Windows and Mac, but doesn't work on Linux as it is.

The code you edited is only active on Windows and Mac (see the surrounding CompilerIf). On Linux the whole enter key handling is different (I think it is directly handled by Scintilla there or something like that) so the whole shortcut does not exist. I think a solution should be found for Linux too in order to make this a complete feature.

Two more suggestions:

  • It should be enabled for the "Project Targets" list as well. There a double-click opens the compiler options so for completeness it would be good if the Enter key did the same here.
  • To fully complete the ability for keyboard navigation it would be good if focus was automatically set to the ListIconGadget when you switch to the project tab. Right now, if you navigate the list and hit enter (switching tabs) and then go back to the project tab the focus will not be on the ListIconGadget and you cannot directly navigate with the keyboard anymore. Automatically setting the focus would improve that. Of course there should be some testing to ensure that this does not mess up some other workflow by taking the focus from something else.

t-harter avatar Aug 11 '21 19:08 t-harter

Linux - I'll look into handling the Enter key

Project Targets List - Agreed, for consistency. Generally I like when Double-Click and Enter do the same action in a List gadget.

Auto-Keyboard-Focus to the List - I like that idea. Will implement and test. Speedy keyboard navigation is nice!

kenmo-pb avatar Aug 12 '21 02:08 kenmo-pb

:heavy_check_mark: OK, I pushed an update:

  1. Rebased onto the latest devel
  2. Instead of duplicating the same functionality for LeftDoubleClick and Return, now the Return shortcut just posts a LeftDoubleClick
  3. Project Targets List now reacts to the Enter key like Project Files
  4. Project Files List grabs the keyboard focus when you navigate to the Project Info tab
  5. You can Tab / Shift+Tab between them. Simple macro ensures a list item is selected, so it's visually obvious

:warning: Still not implemented on Linux. (There's a tricky part to every PR, huh?)

  1. I don't currently have a Linux system to test on.
  2. I looked into the code, tried to figure out why Linux Enter/Tab was handled differently than Windows/Mac. It was a bit more complicated than expected. There are several places in the project where Return/Tab/Shift+Tab shortcuts are dynamically added and removed (including Form Designer). Have to be careful about all cases... I considered adding the Return/Tab shortcuts when entering the Project Info tab, and removing them when leaving that tab.

This PR could either be merged without Linux functionality, or it could be shelved until me or someone else figures out the Linux handling.

kenmo-pb avatar Aug 25 '21 03:08 kenmo-pb

I don't want to sound harsh and I am not trying to diminish your work but I really don't like features that work on only some OS. It will just look like a bug to users who use PB on more than one platform when things that they are used to from one platform simply don't work on another. We are still trying to be a cross-platform toolkit after all.

Platforms-specific features should be reserved for cases where there is a large enough benefit to justify it and then the differences must be well documented so there are no surprises. At least this is how we handled it with the PB library commands recently.

I would suggest to shelve this for the moment and see if somebody can contribute a Linux solution. If there is no solution after a while we can still revisit the question whether to merge it as is or not.

t-harter avatar Aug 25 '21 21:08 t-harter

Platforms-specific features should be reserved for cases where there is a large enough benefit to justify it

The argument in favor of this feature would be accessibility for the blind and visually impaired, which navigate through GUIs using the keyboard. Under Windows, there are special tools that introduce an OS overlay which makes GUIs accessible to bling in various ways (text 2 speech, braille readers, etc.), so any software that uses Windows native controls becomes accessible.

Blind people obviously can't se the mouse, so keyboard navigation is crucial for accessing software that have graphic interfaces.

The fact that this feature doesn't play well with other OSs shouldn't IMO hinder any features which make a software tool accessible to the blind. From my experience, I've seen that Windows is the OS of choice for the blind — at least here in Italy all the blind people I known got a Windows OS with the special accessibility software layer, when they applied from the National Health Service that grants blind people a laptop for equal opportunities.

tajmone avatar Aug 25 '21 21:08 tajmone

Hi @t-harter I have zero problem with your thoughts :slightly_smiling_face:

I understand only merging in features which are fully cross-platform. Should we leave this PR open? Close it and re-open in the future? Mark as "draft"? In the meantime I happily run my own IDE binary with this and other WIP features :grin: (I love that)

kenmo-pb avatar Aug 26 '21 04:08 kenmo-pb

Continued in #212.

t-harter avatar Sep 03 '22 19:09 t-harter