Reference for the Mosaic class Core::CursorEvent

Core::CursorEvent
AutoDeflected
CurrentPos
Down
Finger
GlobalCurrentPos
GlobalHittingPos
HittingPos
HoldPeriod
StrikeCount
InitializeDown()
InitializeHold()
InitializeUp()
Core::Event
IsTimeExact
Time
GetCurrentTime()

The class Core::CursorEvent provides a specialized event object able to deliver touch screen pressure and release events. Each time the user clicks with the mouse cursor on the screen, hits it with a pen or touches it with his finger, a cursor event is prepared and dispatched to the view which is willing to handle it. See the method DriveCursorHitting() of the class Core::Root.

The event contains information about the position where the user has tapped (HittingPos and CurrentPos), whether the user has pressed or released the finger (Down), how often has the user tapped at the same position (StrikeCount), etc.

The dispatching of cursor events will always take place in so called 'grab cycles'. A grab cycle starts when the user touches the screen and exists until the user has released it. At the beginning the framework determines the view which is lying at the touched position and is willing to receive cursor events. This view will become the target for all following events while this grab cycle -> the view 'grabs' the cursor for this time.

Afterwards the target view will receive the first Core::CursorEvent with its variable Down == 'true'. At the end of the grab cycle, after the user has released the finger, the target view will receive the last Core::CursorEvent with the variable Down == 'false'. In the meantime the framework will feed the target view with more events: the hold and the drag events.

The hold events are generated periodically in constant intervals. They store the current cursor position and the time since the grab cycle began HoldPeriod. Please note, these hold events are sent with the variable Down == 'true'. In order to distinguish between the first event and the following hold events, the HoldPeriod variable should be evaluated.

Beside the hold events, the target view will also receive drag events as soon as the user strokes the screen. This is communicated by events of the class Core::DragEvent.

var bool AutoDeflected;

The variable 'AutoDeflected' is 'true', if the event has been sent from the method Core::Root.DeflectCursor() or Core::Root.RetargetCursor(). These methods make possible to hand over the cursor from the current target view to another view. In this manner new target view is determined. The variables allows you to detect the reason of the event.

var point CurrentPos;

The variable 'CurrentPos' stores the current cursor position. This position is valid in the coordinate space of the owner of the target view. In this manner the position can be compared directly with the coordinates of the view.

var bool Down;

The variable 'Down' determines whether the user is still touching the screen. If this variable == 'false' the user has released it.

var int32 Finger;

The variable 'Finger' identifies the finger as an event source within a multi-touch environment. The fingers are numbered with values lying in the range 0 .. 9.

var point GlobalCurrentPos;

The variable 'GlobalCurrentPos' stores the current cursor position expressed in the global (screen) coordinate space.

var point GlobalHittingPos;

The variable 'GlobalHittingPos' stores the position where the user has touched the screen. This is the origin position at the beginning of the grab cycle. This position is expressed in the global (screen) coordinate space.

var point HittingPos;

The variable 'HittingPos' stores the position where the user has touched the screen. This is the origin position at the beginning of the grab cycle. This position is valid in the coordinate space of the owner of the target view. In this manner the position can be compared directly with the coordinates of the view.

var int32 HoldPeriod;

The variable 'HoldPeriod' stores the time in milliseconds how long the user is pressing the finger on the screen. This variable is very useful if the view needs to perform an operation after some time is elapsed. At the begin of the grab cycle the HoldPeriod == 0.

method Core::CursorEvent InitializeDown
(
arg int32 aFinger,
arg point aCurrentPos,
arg int32 aStrikeCount,
arg point aHitOffset,
arg bool aAutoDeflected,
arg point aGlobalCurrentPos
);

The method InitializeDown() simplifies the initialization of this Core::CursorEvent object. This method stores the given parameters in the variables of this event object, sets its variable Down 'true' and returns this event object to the caller.

method Core::CursorEvent InitializeHold
(
arg int32 aFinger,
arg point aCurrentPos,
arg point aHittingPos,
arg int32 aHoldPeriod,
arg int32 aStrikeCount,
arg point aHitOffset,
arg point aGlobalCurrentPos,
arg point aGlobalHittingPos
);

The method InitializeHold() simplifies the initialization of this Core::CursorEvent object. This method stores the given parameters in the variables of this event object, sets its variable Down 'true' and returns this event object to the caller.

method Core::CursorEvent InitializeUp
(
arg int32 aFinger,
arg point aCurrentPos,
arg point aHittingPos,
arg int32 aHoldPeriod,
arg int32 aStrikeCount,
arg point aHitOffset,
arg bool aAutoDeflected,
arg point aGlobalCurrentPos,
arg point aGlobalHittingPos
);

The method InitializeUp() simplifies the initialization of this Core::CursorEvent object. This method stores the given parameters in the variables of this event object, sets its variable Down 'false' and returns this event object to the caller.

var int32 StrikeCount;

The variable 'StrikeCount' stores how often the user has tapped the screen in succession. It is one, if the user has single tapped it. It is two if a double tap took place, and so far.

Such series of taps are recognized only when the taps are performed very quickly and the user doesn't move the finger very much. The appropriate time delay and the valid range for the movement are determined by the properties CursorDragLimit and CursorSequelDelay of the class Core::Root.