ON_CLICK

ON_CLICK N,L

EXECUTES THE PROGRAM FROM LABEL L WHEN THE SYSTEM OBJECT NUMBER N IS CLICKED

  • Type: Command
  • Parameters: 2
  • Group: Events

ACTION

The command ON_CLICK N,L assigns a label (which must be defined in the program) from which the program will run every time the user clicks on the system object designated by the number N.

The system object must be one of the following types: SCENE3D, BUTTON, EDIT, MEMO, COMBO, ALPHA, FORM, LIST, PICTURE, CHECK, OPTION, SUB_MENU, SCENE2D, SPIN, CONTAINER_OPTION.

Remark : for a COMBO, the event corresponds to a click in its drop-down list: a COMBO is like a LIST.

SYNTAX: ON_CLICK N,L

  • N = system object number (integer or real). Must be greater than 0 and less than or equal to the allowed maximum number of system objects.
  • L = Label.

USE

  • The command ON_CLICK is used to associate an event (CLICK) happening to a system object, to a program location (defined by the label L).
  • When the event occurs, the program named by the label is executed.

ERROR

  • If number N is not a correct expression.
  • If number N exceeds the allowed maximum number of system objects.
  • If number N is less than 0.
  • If system object number N does not exist.
  • If system object number N is not of the type : SCENE3D, BUTTON, EDIT, MEMO, COMBO, ALPHA, FORM, LIST, PICTURE, CHECK, OPTION, SUB_MENU, SCENE2D, SPIN, CONTAINER_OPTION.
  • If the label L does not exist.
  • If L is not a correct label name.

EXAMPLE

rem declare a label

label clicked

rem a BUTTON is created

button 1

rem every time the BUTTON is clicked, execute from label "clicked"

on_click 1,clicked

end: rem main program is finished

clicked:

beep: rem treatment of event = beep

return

SEE ALSO

ON_CHANGE