Click or drag to resize

AppWindow.Dispatch Method (Typed)

X#
Provide the dispatcher for events within the system when the window has focus; routing various events to their appropriate event handlers.

Namespace:  XSharp.VO.SDK
Assembly:  XSharp.VOGUIClasses (in XSharp.VOGUIClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD Dispatch(
	oEvt AS Event
) AS USUAL
Request Example View Source

Parameters

oEvt
Type: Event

Return Value

Type: Usual
A numeric value representing the event handler to handle the event. This is usually the value of the EventReturnValue field.
Remarks
Windows receive events from the user and the system all of the time. Each window receives only the events that are relevant to it. For each event that is generated, two things happen: 1. The event is converted to a particular Event object (an ExposeEvent or a MouseEvent, for example) according to the action that triggered the event. 2. The appropriate event handler is called, and this typed Event object is passed to it.
Tip Tip
If you want to set a specific return value for the underlying window procedure, you have to change the EventReturnValue variable for the window object. If you want to handle other events (for example, timer events), you need to write your own Dispatch() method. The following guidelines should be followed when writing a customized Dispatch() method: 1. Subclass an event type appropriate to the type of operation for which it is being used. 2. Add an event handler function to your derived object. (This event handler should be called with the event when the event is received.) 3. In general, the implementation of this event handler should call Default(). This keeps the same behavior as the base class, but it also allows other classes to provide useful event handlers for your new type of event, allowing you to provide a framework for other classes to use. The base class Dispatch() method should be called in those cases where the received event is not handled by the customized dispatcher. For example:
X#
1RETURN SUPER:Dispatch(<oEvent>)
You can now write a DispatchUnknown( oEvent ) method on your own window class to handle messages that are not processed by the window. When this message exists then it will be automatically called by the Dispatch() method inside the Window class.
Examples
X#
1METHOD DispatchUnknown(oEvent) CLASS MyCustomWindow
2// Your code
3// If you need the default window
4//    procedure call SELF:Default(oEvent)
5// Assign the event return value to SELF:EventReturnValue,
6//    the default value is 0l.
7SELF:EventReturnValue := 1l
See Also