Event Handler Editor

Allows you to add event handlers to your application's widgets. Event handlers are attached to widgets and are accessed through the Resource Editor, much like callbacks. Event handlers are not application global. The purpose of event handlers is to let you specify functions to be called when widgets receive certain events.

Click the (...) button to the right of the eventHandler resource in the Resource Editor to pop up the Event Handler Editor:

Event Handler Editor

The display area lists the Handler Name, Event Mask, Non-Maskable setting, Parameter Type, and Parameter of each event handler that has been added to the application.

Selecting, adding, and deleting an event handler

· Select an event handler by clicking on its name in the list. All appropriate fields are updated for the selected event handler.

· Add an event handler to the list by clicking New and entering the Handler Name and any necessary parameter data in the appropriate text fields.

· Delete an event handler by selecting it in the list and clicking the Delete button.

When changing or adding an event handler to the list, you can choose a handler name from the list displayed by clicking on the arrow to the right of the Handler Name label, or you can create a new procedure by typing its name in the Handler Name text field. Builder Xcessory prompts you to confirm a new handler name.

When a widget gets a specified X event, the event handler is called. To specify the X event(s), you must do so in the Event Mask field. You can choose an event mask from the list displayed by clicking on the arrow to the right of the Event Mask label, or type its name in the Event Mask text field. You can choose one or more event masks, separating each mask name with a comma or a logical "or" (|).

New event handlers

New event handlers are created with a default Parameter Type of Undeclared in the Event Handler Editor, indicating that parameter values of any type are accepted in the Parameter field. Other valid values include all pre-defined types, user-defined types, and None. None indicates that the event handler takes no value as its client data. A list is available by clicking on the arrow to the right of the Parameter Type label in the Event Handler Editor.

Declaring additional user-defined types

Additional user-defined types can be declared in the Event Handler Editor by entering the new type name in the Parameter Type field. Builder Xcessory prompts you to confirm a new user-defined type.

The Parameter Type field is grayed out if the event handler specified in the Handler Name field is referenced by a widget or style resource in your interface. The procedure's parameter type cannot be changed, in the Event Handler Editor, unless all references to the handler are removed from the interface.

Matching parameters with the event handler editor

When Builder Xcessory encounters a parameter in the Event Handler Editor, it searches for a match in the following order:

· Identifier

· Constant

If no match is found, Builder Xcessory prompts you to declare the parameter as an identifier.

The Parameter field accepts the following values as client data values to pass to the callback procedure.:

· Constants

· Identifiers

· Boolean

· Integer

· Floating point

· String


Note: String values must be double-quoted.

The type of the value must correspond to the type listed in the Parameter Type field. A list of parameters is available by clicking on the arrow to the right of the Parameter label in the Event Handler Editor.

If the text entered into the Parameter field is not a constant, identifier, or actual value, then Builder Xcessory prompts you to declare the value as an identifier of the appropriate type.

 

Documentation: