You may install two kinds of handlers in an object's script: your own AppleScript handlers, and handlers for the events sent by Smile. The events that Smile may send to an object's script in various occasions are the verbs listed in the "Smile events" Suite in the dictionary of Smile.
The handlers that you write in an object's script run in Smile's global context: the object's script may make use of any handler from the libraries which are installed.
When sending an event to an object's script, Smile always pass the reference to the target object as their direct parameter. Similarly, it is a good practice for your own handlers that one of their parameters be a reference to the owner of the script.
On how to write the handlers for the events sent by Smile, see below for more details about each event.
- prepare: sent when Smile opens a new object
- store: sent when Smile saves the object
- close: sent when a window is closed
- delete: sent when a window is deleted
- activated and deactivated: sent when a window is activated/deactivated
- do menu: sent when the user selects a menu item in the menu bar, in the user-programmable contextual menu or in the toolbar
-
The dialog windows support a specific set of events: click in, sent when the user performs an action in the dialog's widgets, export and drop, the events corresponding to drag and drop. About the events received in a dialog, please consult Events sent to the scripts in a dialog.
-
The graphic windows receives a specific set of events when the user performs actions: pick in (the user clicks or drags the mouse), keydown (the user hits a key or a key combination) and resized (the user resized the window). About the events received in a graphic window, please consult Customizing a graphic window's user interface.
|