Recent

Author Topic: Guide on how to design an application to be fully keyboard driven as possible?  (Read 702 times)

vfclists

  • Hero Member
  • *****
  • Posts: 1147
    • HowTos Considered Harmful?
Is there a guide on how to design a Lazarus GUI program to be keyboard driven as much as possible?

My main concern for now is how to handle the events depending on the active element, whether the widgets themselves handle the events or their parent widgets even the main form handle them.
Lazarus 3.0/FPC 3.2.2

Thaddy

  • Hero Member
  • *****
  • Posts: 16932
  • Ceterum censeo Trump esse delendam
The most used way, and in my opinion the best one is:
TActionlist -> TAction -> TAction.Shortcut'. TAction.OnExecute
But mind you, you should always check if a shortcut is not already taken by the OS and that can differ by OS or even terminal type (e.g. on Windows alt-tab, alt-F4 etc.)
You should also check if there are common standards for the type of application that you write and try to adhere to that.
That will make it easier for the end user, because it may be familiar. E.g. Lazarus mimics a great deal of the Delphi shortcuts.
You can easily check if you did not forget to implement a shortcut for a certain action.
The same action list can also be applied to menu's.

Some familiar sets of keyboard shortcuts are wordstar and msoffice:
http://cpmarchives.classiccmp.org/cpm/Software/Humongous/Editors/WordStar/Manuals/WordStar%20Command%20Reference.htm
and
https://support.microsoft.com/en-us/office/keyboard-shortcuts-in-microsoft-365-e765366f-24fc-4054-870d-39b214f223fd


Note, if you use TActionlist it is always a good idea to write out all actions before you start programming them, so you know your logic beforehand.
« Last Edit: September 23, 2024, 08:21:43 am by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8389
But mind you, you should always check if a shortcut is not already taken by the OS and that can differ by OS or even terminal type (e.g. on Windows alt-tab, alt-F4 etc.)

And that will vary by widget set, i.e. Qt will differ from GTK.

Quote
You should also check if there are common standards for the type of application that you write and try to adhere to that.
That will make it easier for the end user, because it may be familiar. E.g. Lazarus mimics a great deal of the Delphi shortcuts.

Although a friend working for Red Hat discovered that not one of his colleagues had heard of IBM's CUA guidelines on which much of the "UI as we understand it" is based.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 16932
  • Ceterum censeo Trump esse delendam
And many do not know or have read "About Face", by Alan Cooper et.al. which is still the definitive guide to user interface design.
(note to self: buy the 4th edition too, covers mobile etc)
« Last Edit: September 23, 2024, 10:15:17 am by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

 

TinyPortal © 2005-2018