How to change Enter key functionality

By | August 25, 2020

In sage X3, enter key has some default functionality for e.g. in some screens it is used to trigger OK button functionality while in grid level it is used to jump on the next line and so on. So, depending on the requirement and screen type Enter key has different types of functionalities. But with the help of some coding and actions of screens we can actually block the default functionality of Enter key and can replace it with some other functionalities.

Steps to be followed :

So, in sage X3 when Enter key is pressed, X3 assigns the value of GSTARET to the variable RESPONSE. We can check that condition in the “After choice” action depending on the screens and template that we are using. For different screens and templates different actions are used but most notably APRES_CHOI or AP_CHOIX are used. For the below example we can use APRES_CHOI but depending on the template use we have to see which action is exactly used so it might be differ between the two.

So, in the list of actions we have to specify our action in the specific processing file of the script editor:

Fig : Script Editor
Fig : Script Editor

APRES_CHOI action gets called before executing an action (button, menu, left list, etc.)). A status that defines the action is sent by the supervisor in the RESPONSE variable.

It is possible to short-circuit the normal processing of a button, menu, etc.: This action is used to launch its own processing instead of the template processing, then to put RESPONSE back to 0.

The various possible values for the RESPONSE variable are given by global variables and various global variables stored the values of the various actions of button clicks. For example, GSTAENR is used to store Record button action response and so there are different global variables within X3 which are used for all sorts of buttons to hold their values and all.

AP_CHOIX action is called right after “clicking” on a button or a menu.

It is used to execute a processing after having “clicked” on a button or a menu. In effect, for most of the buttons, the processing has no standard processing. The processing needs to be written in this action. The buttons managed by the template are the following:

“END”, “PRINT-OUT”, “LIST”, “ATTACHMENTS”, “COMMENTS”, “PROPERTIES”.

This action takes place before the actions on button ( AVANT_BOUTON, BOUTON and AVANT_XXX, XXX ) where XXX represents the identifier of the predefined button.

This action takes place before the actions on menu (AVANT_MEN, MEN) The RESPONSE variable contains the status of the button and therefore indicates the button activated by the user and global variables used by buttons to hold the values of their status and response.

Then in the action handler we can stop the execution of standard functionality when we assign the value GSTARET to the variable RESPONSE. We can replace it with new customized functionality which might be useful.

Once we can make sure that Infbox statement is getting executed when we press “Enter” on screen, we can place something actually useful in its place depending on our needs.

With the help of above steps, you can change the functionality of Enter key.