Four Js Development Tools Forum

General => Ask Reuben => Topic started by: Reuben B. on August 03, 2023, 04:29:47 am



Title: Ask Reuben 184 - Accelerator Keys
Post by: Reuben B. on August 03, 2023, 04:29:47 am
The concept of "Action Defaults" allows you to code your 4gl independently of how actions are triggered.  If you have ON ACTION zoom, your code does not care how the zoom action was triggered.  The runtime does not care whether the user pressed a function-key, whether they clicked on a BUTTONEDIT icon, whether they clicked on a TOOLBAR item etc.   Whereas if you have coded COMMAND KEY(F5), or ON KEY (F5), then you are restricting the triggering of that action to the user pressing F5, the question you then ask yourself is, “where is the F5 key on your tablet or phone device”?
 
With ON ACTION action-name, you can still indicate a key that can be used to trigger an action.  This is achieved via the acceleratorName attribute in the .4ad file, or via the ACTION DEFAULT section in you form, or via the ATTRIBUTE(ACCELERATOR=) syntax in the 4gl.  Ideally you are doing this in the .4ad file so that you only define this once in your code base.
 
The accept and cancel actions by default have the Return and Escape keys mapped to them in the default .4ad.  I have seen a few cases recently where developers have changed these to the same keys as their old character application.  That is Escape to accept, and Control-C to cancel, or some other combination.  I think you should use the GUI defaults, any resistance from end users disappears quickly if they are using the same keys they use in other GUI applications.

Read more at https://4js.com/ask-reuben/ig-184/