<* PRAGMA LL *>An
AnyEvent.Tis an object that can hold any of the Trestle event-time events. This object type is useful for
VBTmethods that are called in response to multiple styles of user gestures. For instance, the
callbackmethod of a
NumericVBTis invoked either because a user clicked on the plus or minus button or because the user typed a carriage return in the type-in field. The Trestle event is passed to the
callbackmethod as an
AnyEvent.T, and the
callbackmethod can then use a
TYPECASEto differentiate button clicks from carriage returns, and to retrieve the data specific to each type of event.
The locking level is arbitrary for all procedures in this interface.
AnyEvent; IMPORT VBT, Wr; TYPE T = BRANDED OBJECT END; Key = T OBJECT key: VBT.KeyRec END; Mouse = T OBJECT mouse: VBT.MouseRec END; Position = T OBJECT position: VBT.PositionRec END; Misc = T OBJECT misc: VBT.MiscRec END;
The four subtypes of
AnyEvent.Tcorrespond to the four event-time Trestle events: keyboard, mouse, position, and miscellaneous.
PROCEDURE FromKey ( READONLY event: VBT.KeyRec): Key; PROCEDURE FromMouse ( READONLY event: VBT.MouseRec): Mouse; PROCEDURE FromPosition ( READONLY event: VBT.PositionRec): Position; PROCEDURE FromMisc ( READONLY event: VBT.MiscRec): Misc;
eventas an appropriate subtype of
PROCEDURE TimeStamp (anyevent: T): VBT.TimeStamp;
Return the timestamp of the
anyevent. It is a checked runtime error if
anyeventis not a proper subtype of
PROCEDURE ToWr (anyevent: T; wr: Wr.T);
Put a textual representation of
anyeventonto the writer