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:

REPONSE Status Button
GSTAESC 7 End
GSTANEW 91 New 
GSTAENR 92 Save button
GSTACRE 93 Create
GSTAANU 94 Delete
GSTASEL 95 Selection
GSTAFIR 96 First
GSTALAS 97 Last
GSTASUI 98 Next
GSTAPRE 99 Previous
GSTAOK 1029 Ok
GSTAFIN 1792 Cancel
GSTACHG 1793 Code change
GSTAJOI 1794 Attachments
GSTACOM 1795 Comments
GSTAEDI 1796 Printing
GSTALIS 1797 List
GSTADAT 1798 Properties
GSTARAF 1799 Left 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.