Satimage Previous | Next
click in
Home Documentation Smile Custom GUI Developing your own custom dialog Scripting a dialog Events sent to the scripts in a dialog click in  
  • When the user interacts with a control in a dialog (for instance when the user clicks a button, enters text or selects an item in a local menu), the script of the container of the control (for instance, the dialog's script) receives the following event.
    click in the_object item number the_index
    the_object contains a reference to the container of the concerned control - the owner of the script.
    the_index contains the index of the control. The index of a control is the number visible in its bottom-right corner when you select the control while the dialog is in edit mode.

  • For instance, if you install a button in a dialog, your handler for handling the user's click is in the script of the dialog: except for rare situations, a button's script should be empty.
  • You handle click in with a handler such as:
    on click in the_object item number the_index
        set the_button to dialog item the_index of the_object
        if the_index is 1 then
            -- handle user's action
        else if the_index is 2 then
            -- handle user's action
        end if
    end click in
    click in does not provide directly a reference to the control that was addressed by the user. A reference to that control is:
    dialog item the_index of the_object
  • By default, Smile keeps silent the execution errors that occur in a click in handler. If you want to be notified of execution errors that might occur in a click in handler, encapsulate the body of your handler within a try [...] on error [...] end try wrapper and handle the error.
Copyright ©2008 Paris, Satimage