General Interface is an open source project hosted by the Dojo Foundation

Specifying Model Events

In addition to properties, objects can also have model events that are published in response to user actions. For example, the Execute event for a component might be published in response to an onkeypress or onclick event. A model event is an abstraction layer that wraps native browser events. Model events translate events from the domain of the browser user interface into events from the General Interface model domain. Model events are persistent in General Interface GUI component serialization files and are thus a static binding from the user interface definition to JavaScript code. Model events, with a few exceptions such as hide, destroy, and show, can't be generated programmatically. Events are typically only generated by the user interaction with the browser.

In General Interface 3.1, the event model changed. By default, projects created in General Interface 3.1 and later use the 3.1 event model. However, you can set your project to use the 3.0 event model for backward compatibility. See the General Interface Developer Guide.

The majority of model events grant access to the current wrapped event object with objEVENT and are only generated by user interaction. If a model event doesn't provide access to objEVENT, it may be generated programmatically. Events are documented in the Events Editor palette.

To learn more about events in the Events Editor palette, hover the mouse over the event name or see General Interface GUI Event Reference (Help > API Documentation > GUI Event Reference).

Events that can be generated programmatically include the following:

  • All Classes: Destroy
  • Button: Execute.
    Button has a doExecute() method that allows the Execute model event to fire without a browser event.
  • DatePicker: Show/Hide
  • Menu: Hide
  • Stack: Show
  • Tab: Show/Hide
  • TabbedPane: Change

To specify a model event for a component, complete these steps:

  1. Select a component in the work area or the Component Hierarchy palette.
  2. In the Events Editor palette, click in the Value column next to the event name.
  3. Type the JavaScript code to run when the event is published.
    Click here to expand screenshot...

Contents

Searching General Interface Docs

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.