XI uses a custom event system because of difficulties with simulating events with the UITK event system. With only using he UITK event system it is difficult to take control of event propagation and dispatching, simulating actions based on custom input, and simulating focus and capture actions with a world-space (non screen-space) UI system. So, a series of “Controllers” were made to dispatch events and execute UI actions without using UITK.

Events are broken down into the following categories:

  1. Input Events: created directly from inputs
  2. Intermediate Events: additional input types generated from input events
  3. Interface Events: created internally within UI elements or manipulators

Input Events

There are two types of input events: (1) CursorEvent and (2) FocalEvent. Cursor events are input events from cursors interacting with a document. FocalEvents are code events from keyboard, that are sent only to the focused document.

Input events can be generated by providing inputs to the XIManager. Call XIManager.AddPointerInput and XIManager.AddKeyInput on Update with input states for any appropriate device.

Inputs can also be simulated by sending custom input events with XIManager.Dispatch functions. This is useful, for example, when creating a custom keyboard that should send code events when virtual buttons are “pushed” or for creating unit tests.

Handling Events

Events are handled in a similar way as UITK. Call RegisterCallback with the approate XIEvent to execute actions when this event is received.

Events Table

Event Type Fields Description
PositionEvent Input Vector3 Position Hovering cursor position
PushEvent Input int Button Cursor button press down
PopEvent Input int Button Cursor button press up
AxixEvent Input Vector2 Axis Cursor axis delta
CodePushEvent Input Code Code Code/key press down
CodePopEvent Input Code Code Code/key push up
EnterEvent Intermediate Vector3 Position Cursor enters element
MotionEvent Intermediate Vector3 Position, Vector3 Delta, float Proximity Cursor moves within element
ExitEvent Intermediate Vector3 Position Cursor leaves element
HoverEnterEvent Interface - First pointer enters element
HoverExitEvent Interface - Last pointer exits element
ExecuteEvent Interface int Button Push and pop while hovering
CodeEvent Interface Code Code Repeated after CodePush and stopped after CodePop or lost of focus
ChangeEvent<T> Interface T Previous, T New Editable field value changed
FocusEvent Interface FocusType FocusType Focusable element gains or loses focus
ScrollEvent Interface Vector2 Scroll Element view has been scrolled / panned

XI - Copyright © Jonathan Lacombe