public class DhEvent
Carries event information from source to sink. This object is the only parameter on any HTML event callback. The information relayed in this class is rich and deep. Probably the best way to understand all the different information conveyed here is to experiment.
Start with the following code example:
import wfc.html.*; import wfc.html.event.*; public class DumpEvent extends DhModule { DhDocument document; DhText text; public void documentLoad(Object sender, DhEvent e) { document = getDocument(); text = new DhText(); document.add(text,DhDocument.INSERT_BEGINNING); document.addOnMouseMove( new DhEventHandler(this,"onMouseMove") ); } public void onMouseMove( Object sender, DhEvent event ) { text.setText( event.toString() ); } }
Compile that code and put the result onto your CLASSPATH. Now put the following portion of HTML code onto any page:
<object classid="java:DumpEvent"></object>
Now point Internet Explorer (4.0 or later) at that page. As you move the mouse around the page and over elements, hold down various keys (ALT, CTRL, and so on). You will see the results of all the different types of keyboard and mouse position information available to you.
You should also note the effects of the event bubbling. This is an effect caused by the fact that all event sources in HTML trigger the same events all the way up their containment hierarchy. (This is also known as bubbling, broadcasting, or multicasting.) Because the mouse move events are sinked at the document (the top of the containment hierarchy), we see all mouse move events of all elements on the screen.
Fields
Name | Description |
---|---|
EVT_LEFTBUTTON | Indicates that the left mouse button has been pressed. |
EVT_MIDDLEBUTTON | Indicates that the middle mouse button has been pressed. |
EVT_NOBUTTON | Indicates that no mouse button has been pressed. |
EVT_RIGHTBUTTON | Indicates that the right mouse button has been pressed. |
Methods
Name | Description |
---|---|
cancelBubble() | All event sources in HTML trigger the same events all the way up their containment hierarchy Calling this method tells the HTML document to stop event bubbling. |
getChar() | Tests for the presence of any key and returns that keypress. |
getClientPoint() | Retrieves the current position of the mouse relative to the parent client area. |
getDocument() | Retrieves the document object on which this event was triggered. |
getMouseButton() | Tests for mouse button events. |
getOffsetPoint() | Retrieves the current position of the mouse relative to the element's client area. |
getPeer() | Retrieves the underlying HTML peer element for this class. |
getPoint() | Retrieves the current position of the mouse relative to the document client. |
getReturnValue() | Determines if return data has been set. |
getScreenPoint() | Retrieves the current position of the mouse relative to the desktop. |
getSource() | Retrieves the original source of the event. |
isAltKey() | Tests for the ALT key. |
isCtrlKey() | Tests for the CTRL key. |
isShiftKey() | Tests for the SHIFT key. |
setChar( int c ) | Topic under construction. |
setReturnValue(boolean b) | Sets return data. |
setReturnValue(String s) | Sets return data. |
setReturnValue(int i) | Sets return data. |
setReturnValue( Variant v) | Sets return data. |
toString() | Converts this event object to a string. |
All event sources in HTML trigger the same events all the way up their containment hierarchy Calling this method tells the HTML document to stop event bubbling.
Returns the key code of the currently pressed key (or 0 if no key is pressed).
Tests for the presence of any key and returns that keypress.
Returns the current position of the mouse relative to the parent client area.
Retrieves the current position of the mouse relative to the parent client area.
Returns the document object this event came from.
Retrieves the document object on which this event was triggered.
Returns one of the mouse buttons constants (EVT_NOBUTTON, EVT_LEFTBUTTON, EVT_RIGHTBUTTON, or EVT_MIDDLEBUTTON).
Tests for mouse button events.
Returns the current position of the mouse.
Retrieves the current position of the mouse relative to the element's client area.
Returns the element peer underlying the HTML peer for this class.
Retrieves the underlying HTML peer element for this class. This method may return null if the event is not bound to the document. Java code that is running in a trusted environment can freely cast the resulting reference to a specific element peer type (for example, wfc.html.om.IHTMLEventObj). This method always returns null if the code is running in a Web server environment.
Note Calling this method represents a very advanced usage scenario. Typically, you would never use this method.
Returns the current position of the mouse.
Retrieves the current position of the mouse relative to the document client.
Determines if return data has been set. Certain kinds of events require a response value. Use this method to see if another handler has set the return data to the event source.
Returns the current position of the mouse.
Retrieves the current position of the mouse relative to the desktop.
Returns the element that first triggered this event.
Retrieves the original source of the event. This may be the object you actually hooked the event on, or it may one of its children (because all events bubble up the containment hierarchy automatically).
Returns true if the ALT key is pressed.
Tests for the ALT key.
Returns true if the CTRL key is pressed.
Tests for the CTRL key.
Returns true if the SHIFT key is pressed.
Tests for the SHIFT key.
Topic under construction.
Sets return data. Certain kinds of events require a response value. Use this method to return data to the event source.
Sets return data. Certain kinds of events require a response value. Use this method to return data to the event source.
Sets return data. Certain kinds of events require a response value. Use this method to return data to the event source.
Sets return data. Certain kinds of events require a response value. Use this method to return data to the event source.
Converts this event object to a string. Use this when performing diagnostics on your code.