Tip always follow template script structures
The scripts used for handling the events in class and representation classes MUST follow the template described here:
# This first label is called for every global event
# Including events such as AUPDATE, AREAD, AINSERT_CONTROL_AFTER... defined by ACTION variable
# If multiple levels of documents exist, CURPTH will give you the scope and you have also to test it
# In the example above:
# - we manage global events on the class
# - we have a collection of children instances called MYCOL, on which we manage some other events
# - we manage rules on several properties (PROP1, PROP2, PROP3) and on a property in a collection line
# - every event tested is managed in a separate section called by Gosub
#**
#* Label for coding event of CRUD
#* @param CURPTH Local Char(250), contains the class path
#* @param EVENT Local Char(20), contains the event code
#* @return ASTATUS Local Integer
#*!
$EVENTS
Case [L]CURPTH
When ""
Case [L]EVENT
When "AREAD" : Gosub AREAD
When "AINSERT" : Gosub AINSERT
When "AUPDATE" : Gosub AUPDATE
When "ADELETE" : Gosub ADELETE
Endcase
When "MYCOL"
Case [L]EVENT
When "AREAD_AFTER" : Gosub MYCOL_AREAD_AFTER
When "ADDLINE_AFTER" : Gosub MYCOL_ADDLINE_AFTER
Endcase
Endcase
Return
#**
#* Label for coding your application methods
#* @param AMETHOD Local Char(20), contains the operation code
#* @return ARET_VALUE (the type of the return value is declared in the method)
#*!
$METHODS
Case [L]AMETHOD
Endcase
Return
#**
#* Label for coding your application operations
#* @param AOPERATION Local Char(20), contains the operation code
#* @return ARET_VALUE (the type of the return value is declared in the method)
#*!
$OPERATIONS
Case [L]AOPERATION
Endcase
Return
#**
#* Label for coding rules properties
#* @param CURPRO, contains the property code
#* @param ARULE, contains the rule code
#* @return ASTATUS Local Integer
#*!
$PROPERTIES
Case [L]CURPRO
When "PROP1" : Gosub PROP1
When "PROP2" : Gosub PROP2
When "PROP3" : Gosub PROP3
When "MYCOL.PROP4" : Gosub MYCOL_PROP4
Endcase
Return
# Rules associated to the PROP1 property
$PROP1
Case [L]ARULE
When "CONTROL" : Gosub PROP1_CONTROL
When "PROPAGATE" : Gosub PROP1_PROPAGATE
Endcase
Return
....