Pointer​Point Pointer​Point Pointer​Point Class

Definition

Provides basic properties for the input pointer associated with a single mouse, pen/stylus, or touch contact.

In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint and GetIntermediatePoints, always use the context of the app.

public : sealed class PointerPoint : IPointerPointpublic sealed class PointerPoint : IPointerPointPublic NotInheritable Class PointerPoint Implements IPointerPoint
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

In the following example, we query various pointer properties using a PointerPoint object.

// Get extended pointer data.
function queryPointer(e) {
    // We get the extended pointer info through the getCurrentPoint method
    // of the event argument. (We recommend using getCurrentPoint 
    // to ensure the coordinate space is in relation to the target.)
    // Note: getCurrentPoint and currentPoint are only available in the 
    // local compartment, they are not available in the web compartment.
    var pt = e.getCurrentPoint(e.currentTarget);
    var ptTargetProperties = pt.properties;

    var details = "Pointer Id: " + e.pointerId;
    switch (e.pointerType) {
        case "mouse":
            details += "\nPointer type: mouse";
            details += "\nLeft button: " + ptTargetProperties.isLeftButtonPressed;
            details += "\nRight button: " + ptTargetProperties.isRightButtonPressed;
            details += "\nWheel button: " + ptTargetProperties.isMiddleButtonPressed;
            details += "\nX1 button: " + ptTargetProperties.isXButton1Pressed;
            details += "\nX2 button: " + ptTargetProperties.isXButton2Pressed;
            break;
        case "pen":
            details += "\nPointer type: pen";
            if (pt.isInContact) {
                details += "\nPressure: " + ptTargetProperties.pressure;
                details += "\nrotation: " + ptTargetProperties.rotation;
                details += "\nTilt X: " + ptTargetProperties.tiltX;
                details += "\nTilt Y: " + ptTargetProperties.tiltY;
                details += "\nBarrel button pressed: " + ptTargetProperties.isBarrelButtonPressed;
            }
            break;
        case "touch":
            details += "\nPointer type: touch";
            details += "\nPressure: " + ptTargetProperties.pressure;
            details += "\nrotation: " + ptTargetProperties.rotation;
            details += "\nTilt X: " + ptTargetProperties.tiltX;
            details += "\nTilt Y: " + ptTargetProperties.tiltY;
            break;
        default:
            details += "\nPointer type: " + "n/a";
            break;
    }
    details += "\nPointer location (target): " + e.offsetX + ", " + e.offsetY;
    details += "\nPointer location (screen): " + e.screenX + ", " + e.screenY;

    return details;
}
// Get extended pointer data.
function queryPointer(e) {
    // We get the extended pointer info through the getCurrentPoint method
    // of the event argument. (We recommend using getCurrentPoint 
    // to ensure the coordinate space is in relation to the target.)
    // Note: getCurrentPoint and currentPoint are only available in the 
    // local compartment, they are not available in the web compartment.
    var pt = e.getCurrentPoint(e.currentTarget);
    var ptTargetProperties = pt.properties;

    var details = "Pointer Id: " + e.pointerId;
    switch (e.pointerType) {
        case "mouse":
            details += "\nPointer type: mouse";
            details += "\nLeft button: " + ptTargetProperties.isLeftButtonPressed;
            details += "\nRight button: " + ptTargetProperties.isRightButtonPressed;
            details += "\nWheel button: " + ptTargetProperties.isMiddleButtonPressed;
            details += "\nX1 button: " + ptTargetProperties.isXButton1Pressed;
            details += "\nX2 button: " + ptTargetProperties.isXButton2Pressed;
            break;
        case "pen":
            details += "\nPointer type: pen";
            if (pt.isInContact) {
                details += "\nPressure: " + ptTargetProperties.pressure;
                details += "\nrotation: " + ptTargetProperties.rotation;
                details += "\nTilt X: " + ptTargetProperties.tiltX;
                details += "\nTilt Y: " + ptTargetProperties.tiltY;
                details += "\nBarrel button pressed: " + ptTargetProperties.isBarrelButtonPressed;
            }
            break;
        case "touch":
            details += "\nPointer type: touch";
            details += "\nPressure: " + ptTargetProperties.pressure;
            details += "\nrotation: " + ptTargetProperties.rotation;
            details += "\nTilt X: " + ptTargetProperties.tiltX;
            details += "\nTilt Y: " + ptTargetProperties.tiltY;
            break;
        default:
            details += "\nPointer type: " + "n/a";
            break;
    }
    details += "\nPointer location (target): " + e.offsetX + ", " + e.offsetY;
    details += "\nPointer location (screen): " + e.screenX + ", " + e.screenY;

    return details;
}
function queryPointer(e) {
    /// <summary>
    /// Get extended pointer data.
    /// </summary>
    /// <param name="e" type="Event">The event argument.</param>

    // We get the extended pointer info through the getCurrentPoint method
    // of the event argument. (We recommend using getCurrentPoint 
    // to ensure the coordinate space is in relation to the target.)
    // Note: getCurrentPoint and currentPoint are only available in the 
    // local compartment, they are not available in the web compartment.

    var pt = e.getCurrentPoint(e.currentTarget);
    var ptTargetProperties = pt.properties;

    var details = "Pointer Id: " + e.pointerId;
    switch (e.pointerType) {
        case "mouse":
            details += "\nPointer type: mouse";
            details += "\nLeft button: " + ptTargetProperties.isLeftButtonPressed;
            details += "\nRight button: " + ptTargetProperties.isRightButtonPressed;
            details += "\nWheel button: " + ptTargetProperties.isMiddleButtonPressed;
            details += "\nX1 button: " + ptTargetProperties.isXButton1Pressed;
            details += "\nX2 button: " + ptTargetProperties.isXButton2Pressed;
            break;
        case "pen":
            details += "\nPointer type: pen";
            if (pt.isInContact) {
                details += "\nPressure: " + ptTargetProperties.pressure;
                details += "\nrotation: " + ptTargetProperties.rotation;
                details += "\nTilt X: " + ptTargetProperties.xtilt;
                details += "\nTilt Y: " + ptTargetProperties.ytilt;
                details += "\nBarrel button pressed: " + ptTargetProperties.isBarrelButtonPressed;
            }
            break;
        case "touch":
            details += "\nPointer type: touch";
            details += "\nPressure: " + ptTargetProperties.pressure;
            details += "\nrotation: " + ptTargetProperties.rotation;
            details += "\nTilt X: " + ptTargetProperties.xtilt;
            details += "\nTilt Y: " + ptTargetProperties.ytilt;
            break;
        default:
            details += "\nPointer type: " + "n/a";
            break;
    }
    details += "\nPointer location (target): " + e.offsetX + ", " + e.offsetY;
    details += "\nPointer location (screen): " + e.screenX + ", " + e.screenY;

    return details;
}
String queryPointer(PointerPoint ptrPt)
{
    String details = "";

    switch (ptrPt.PointerDevice.PointerDeviceType)
    {
        case Windows.Devices.Input.PointerDeviceType.Mouse:
            details += "\nPointer type: mouse";
            break;
        case Windows.Devices.Input.PointerDeviceType.Pen:
            details += "\nPointer type: pen";
            if (ptrPt.IsInContact)
            {
                details += "\nPressure: " + ptrPt.Properties.Pressure;
                details += "\nrotation: " + ptrPt.Properties.Orientation;
                details += "\nTilt X: " + ptrPt.Properties.XTilt;
                details += "\nTilt Y: " + ptrPt.Properties.YTilt;
                details += "\nBarrel button pressed: " + ptrPt.Properties.IsBarrelButtonPressed;
            }
            break;
        case Windows.Devices.Input.PointerDeviceType.Touch:
            details += "\nPointer type: touch";
            details += "\nrotation: " + ptrPt.Properties.Orientation;
            details += "\nTilt X: " + ptrPt.Properties.XTilt;
            details += "\nTilt Y: " + ptrPt.Properties.YTilt;
            break;
        default:
            details += "\nPointer type: n/a";
            break;
    }

    GeneralTransform gt = Target.TransformToVisual(page);
    Point screenPoint;

    screenPoint = gt.TransformPoint(new Point(ptrPt.Position.X, ptrPt.Position.Y));
    details += "\nPointer Id: " + ptrPt.PointerId.ToString() +
        "\nPointer location (parent): " + ptrPt.Position.X + ", " + ptrPt.Position.Y +
        "\nPointer location (screen): " + screenPoint.X + ", " + screenPoint.Y;
    return details;
}
String queryPointer(PointerPoint ptrPt)
{
    String details = "";

    switch (ptrPt.PointerDevice.PointerDeviceType)
    {
        case Windows.Devices.Input.PointerDeviceType.Mouse:
            details += "\nPointer type: mouse";
            break;
        case Windows.Devices.Input.PointerDeviceType.Pen:
            details += "\nPointer type: pen";
            if (ptrPt.IsInContact)
            {
                details += "\nPressure: " + ptrPt.Properties.Pressure;
                details += "\nrotation: " + ptrPt.Properties.Orientation;
                details += "\nTilt X: " + ptrPt.Properties.XTilt;
                details += "\nTilt Y: " + ptrPt.Properties.YTilt;
                details += "\nBarrel button pressed: " + ptrPt.Properties.IsBarrelButtonPressed;
            }
            break;
        case Windows.Devices.Input.PointerDeviceType.Touch:
            details += "\nPointer type: touch";
            details += "\nrotation: " + ptrPt.Properties.Orientation;
            details += "\nTilt X: " + ptrPt.Properties.XTilt;
            details += "\nTilt Y: " + ptrPt.Properties.YTilt;
            break;
        default:
            details += "\nPointer type: n/a";
            break;
    }

    GeneralTransform gt = Target.TransformToVisual(page);
    Point screenPoint;

    screenPoint = gt.TransformPoint(new Point(ptrPt.Position.X, ptrPt.Position.Y));
    details += "\nPointer Id: " + ptrPt.PointerId.ToString() +
        "\nPointer location (parent): " + ptrPt.Position.X + ", " + ptrPt.Position.Y +
        "\nPointer location (screen): " + screenPoint.X + ", " + screenPoint.Y;
    return details;
}

Remarks

The PointerPoint class implements IPointerPoint.

See PointerPointProperties for extended properties accessible through Properties.

Note

: This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).

Properties

FrameId FrameId FrameId

Gets the ID of an input frame.

public : unsigned short FrameId { get; }public uint FrameId { get; }Public ReadOnly Property FrameId As uint
Value
unsigned short uint uint

The frame ID.

Attributes

Remarks

A frame is a collection of input points at a specific instance in time. The frame ID is a common identifier for each input point in the collection.

IsInContact IsInContact IsInContact

Gets a value that indicates whether the physical entity (touch, pen/stylus, or mouse button) is pressed down.

public : PlatForm::Boolean IsInContact { get; }public bool IsInContact { get; }Public ReadOnly Property IsInContact As bool
Value
PlatForm::Boolean bool bool

True if pressed down; false otherwise.

Attributes

PointerDevice PointerDevice PointerDevice

Gets information about the device associated with the input pointer.

public : PointerDevice PointerDevice { get; }public PointerDevice PointerDevice { get; }Public ReadOnly Property PointerDevice As PointerDevice
Value
PointerDevice PointerDevice PointerDevice

The input device.

Attributes

PointerId PointerId PointerId

Gets a unique identifier for the input pointer.

public : unsigned short PointerId { get; }public uint PointerId { get; }Public ReadOnly Property PointerId As uint
Value
unsigned short uint uint

A unique value that identifies the input pointer.

Attributes

Position Position Position

Gets the location of the pointer input in client coordinates.

public : Point Position { get; }public Point Position { get; }Public ReadOnly Property Position As Point
Value
Point Point Point

The client coordinates, in device-independent pixel (DIP).

Attributes

Remarks

Position contains the client coordinates of the pointer input as interpreted by the system. Under some circumstances, such as input prediction, this data can be modified by the system to compensate for hardware latency or message latency due to inherent delays in sensing and processing the pointer location on the digitizer.

See RawPosition for information on handling raw input data.

See Also

Properties Properties Properties

Gets extended information about the input pointer.

public : PointerPointProperties Properties { get; }public PointerPointProperties Properties { get; }Public ReadOnly Property Properties As PointerPointProperties
Value
PointerPointProperties PointerPointProperties PointerPointProperties

The extended properties exposed by the input device.

Attributes

RawPosition RawPosition RawPosition

Gets the raw location of the pointer input in client coordinates.

public : Point RawPosition { get; }public Point RawPosition { get; }Public ReadOnly Property RawPosition As Point
Value
Point Point Point

The client coordinates, in device-independent pixel (DIP).

Attributes

Remarks

RawPosition contains the client coordinates of the input pointer as reported by the input device. Under some circumstances, such as input prediction, this data can be modified by the system to compensate for hardware latency or message latency due to inherent delays in sensing and processing the pointer location on the digitizer.

See Position for more information on handling modified input data.

See Also

Timestamp Timestamp Timestamp

Gets the time when the input occurred.

public : ulong Timestamp { get; }public ulong Timestamp { get; }Public ReadOnly Property Timestamp As ulong
Value
ulong ulong ulong

The time, relative to the system boot time, in microseconds.

Attributes

Methods

GetCurrentPoint(UInt32) GetCurrentPoint(UInt32) GetCurrentPoint(UInt32)

Retrieves position and state information for the specified pointer.

In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint and GetIntermediatePoints, always use the context of the app.

public : static PointerPoint GetCurrentPoint(unsigned int pointerId)public static PointerPoint GetCurrentPoint(UInt32 pointerId)Public Static Function GetCurrentPoint(pointerId As UInt32) As PointerPoint
Parameters
pointerId
unsigned int UInt32 UInt32

The ID of the pointer.

Returns

The pointer property values.

Attributes

Remarks

GetCurrentPoint is a static method.

See Also

GetCurrentPoint(UInt32, IPointerPointTransform) GetCurrentPoint(UInt32, IPointerPointTransform) GetCurrentPoint(UInt32, IPointerPointTransform)

Retrieves the transformed information for the specified pointer.

In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint and GetIntermediatePoints, always use the context of the app.

public : static PointerPoint GetCurrentPoint(unsigned int pointerId, IPointerPointTransform transform)public static PointerPoint GetCurrentPoint(UInt32 pointerId, IPointerPointTransform transform)Public Static Function GetCurrentPoint(pointerId As UInt32, transform As IPointerPointTransform) As PointerPoint
Parameters
pointerId
unsigned int UInt32 UInt32

The ID of the pointer.

transform
IPointerPointTransform IPointerPointTransform IPointerPointTransform

The transform to apply to the pointer.

Returns

The pointer property values.

Attributes

Remarks

GetCurrentPoint is a static method.

This method is useful for getting pointer information relative to a specific element.

See Also

GetIntermediatePoints(UInt32) GetIntermediatePoints(UInt32) GetIntermediatePoints(UInt32)

Retrieves position and state information for the specified pointer, from the last pointer event up to and including the current pointer event.

In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint and GetIntermediatePoints, always use the context of the app.

public : static IVector<PointerPoint> GetIntermediatePoints(unsigned int pointerId)public static IList<PointerPoint> GetIntermediatePoints(UInt32 pointerId)Public Static Function GetIntermediatePoints(pointerId As UInt32) As IList( Of PointerPoint )
Parameters
pointerId
unsigned int UInt32 UInt32

The ID of the pointer.

Returns
IVector<PointerPoint> IList<PointerPoint> IList<PointerPoint>

The transformed pointer properties (current and historic).

Attributes

Remarks

GetIntermediatePoints is a static method.

The most recent pointer information retrieved by this method is equivalent to that retrieved by the GetCurrentPoint method.

See Also

GetIntermediatePoints(UInt32, IPointerPointTransform) GetIntermediatePoints(UInt32, IPointerPointTransform) GetIntermediatePoints(UInt32, IPointerPointTransform)

Retrieves the transformed position and state information for the specified pointer, from the last pointer event up to and including the current pointer event.

In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint and GetIntermediatePoints, always use the context of the app.

public : static IVector<PointerPoint> GetIntermediatePoints(unsigned int pointerId, IPointerPointTransform transform)public static IList<PointerPoint> GetIntermediatePoints(UInt32 pointerId, IPointerPointTransform transform)Public Static Function GetIntermediatePoints(pointerId As UInt32, transform As IPointerPointTransform) As IList( Of PointerPoint )
Parameters
pointerId
unsigned int UInt32 UInt32

The ID of the pointer.

transform
IPointerPointTransform IPointerPointTransform IPointerPointTransform

The transform to apply to the pointer.

Returns
IVector<PointerPoint> IList<PointerPoint> IList<PointerPoint>

The transformed pointer properties (current and historic).

Attributes

Remarks

GetIntermediatePoints is a static method.

This method is useful for getting pointer information relative to a specific element.

The most recent pointer information retrieved by this method is equivalent to that retrieved by the GetCurrentPoint method.

See Also

See Also