AP_CHOIX

Description

This action is called right after "clicking" on a button or a menu.

Template

Window entry

Use

It is used to execute a processing after having "cicked" 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.

For the preddefined buttons, you will find here below the variables that identify the button:

REPONSEStatusButton
GSTAESC7End
GSTANEW91New 
GSTAENR92Save button
GSTACRE93Create
GSTAANU94Delete
GSTASEL95Selection
GSTAFIR96First
GSTALAS97Last
GSTASUI98Next
GSTAPRE99Previous
GSTAOK1029Ok
GSTAFIN1792Cancel
GSTACHG1793Code change
GSTAJOI1794Attachments
GSTACOM1795Comments
GSTAEDI1796Printing
GSTALIS1797List
GSTADAT1798Properties
GSTARAF1799Left list refresh

For the other buttons, the RESPONSE variable contains a status that starts with:
1101    for the validating buttons
1801    for the non-validating buttons
2001    for the menus 

So, in the presence of 2 validating buttons followed by one non-validating button, the following statuses are obtained in the RESPONSE variable:
1101
1102
1803

This status is not used directly because it is dependent on the position of the button in the window dictionary. First, the position of the button is searched in the window dictionary, then, based on this position, the code of the button is deduced. Tow tables are available: LBOUT(n) contains the status of the buttons, CBOUT(n) contains the codes of the buttons (n being the position of the button in the window dictionary).

For instance:

$AP_CHOIX
Local Integer I
I=find(RESPONSE,LBOUT)
If I<1: Return : Endif
Case CBOUT(I-1)
    When "M"
    When "R"
    When "E"
Endcase
Return

The AVANT_BOUTON and AVANT_MEN actions are used more often because their button/menu code can be exploited by the BOUT variable.