Writing Widget Event Code

To enable widget events, you must first specify events for a control from its coding properties tab.

During code generation, the event delegate gets generated into the custom folder. The event delegate is called by control.setCustomEventsDelegate(eventDelegate, eventTyle) in the configureObjectHandlersById method.

At runtime, the control’s specified events are passed to the event delegate and handled by your code. The event delegate implements IcustomEventsDelegate and has the following methods to handle a variety of events:

The following sample code shows how to write widget events:

public void onOrientationChange(Object field, int controlID, 
                                int width, int height) {
  // custom code
  Switch(controlID)
  {
  case BOBScreenCustomers.BUTTON:
    Dialog.alert("button orientation changed!");
  default:
    return;
  }
};