DhEventHandler Class

DhEventHandler Class

This Package | All Packages

public multicast delegate void DhEventHandler(Object sender, DhEvent event);

Represents an event callback object. You create this when you need to sink an event off an HTML element. The following example code calls DhElement.addOnClick when a button is clicked:


     public void documentLoad(Object sender, DhEvent e)
     {
        DhButton b1 = new DhButton();

        b1.setText("Say hello");

        b1.addOnClick( new DhEventHandler( this.myHandler) );

        getDocument().add(b1);

      }

      public void myHandler( Object sender, DhEvent e )
      {
          // event handler code...
      }

The method signature that you use as your sink must have a void return type and two arguments, of type Object and DhEvent. The Object parameter is the object sending the event; in the example above, it would be the DhButton. The DhEvent parameter is an object which can be queried for further information about the event.