locked
PointerReleased Event Not Friring. RRS feed

  • Question

  • Hello,

    I am tracking pointer state and movement for a drawing application. I am attaching pointer event handlers to the canvas I am drawing on. I noticed that if I release my mouse while I am moving it simultaneously, my PointerReleased event handler is never triggered. As long as I I am not moving the mouse, everything is working as expected. Is this a bug? My related question is; is there a way to get information about the current state of the pointer device. For example, if we are dealing with a mouse, can I retrieve the information programatically to see if the mouse button is currently pressed?

    Thanks in advance

    Wednesday, February 29, 2012 8:57 PM

Answers

  • Hi higgenkreuz,

    I can't reproduce this on the Consumer Preview. I added your Xaml and event handlers which reported the ID of the pointer sending them to debug output and always received the PointerReleased event regardless of whether the mouse was moving or not.

    You can use PointerPoint.GetCurrentPoint to access the status of a specific PointerID. If you keep track of the specific PointerIDs being tracked in PointerPressed then it will be easier for you to enable full touch input rather than being restricted to just the mouse.

    --Rob

    Friday, March 2, 2012 1:34 AM
    Moderator

All replies

  • Hi higgenkreuz,

    Are you running into this on the Developer Preview or the Consumer Preview? Is the mouse the only pointer being tracked when this occurs or are you mixing pointer types? Is the pointer being released over the canvas or is it elsewhere? Is the canvas capturing the pointer when it is first pressed?

    --Rob

    Thursday, March 1, 2012 5:47 PM
    Moderator
  • Hi Rob,

    I am running this on the developer preview.

    I am tracking PointerPressed, PointerReleased and PointerMoved events. I am not checking for pointer type (whether it is a stylus or a mouse), for now I assume a mouse and I am testing it with a mouse. The pointer is released over the canvas, I will later introduce the PointerExited and PointerEntered event handlers as well. I could not observe this behaviour on PointerPressed when the mouse is moving, in that case the app behaves as expected.

    Is there a way to check pointer status (whether it is pressed or not) at runtime? Currently I am just setting a field variable whenever these events happen, but is there a better way to do this?

    Below is my code in XAML as well as the event handlers;

    <Canvas x:Name="myCanvas" Grid.Column="1" Margin="8" Background="#FFF1EEEE"  
                        PointerReleased="handlePointerReleased"
                        PointerMoved="handlePointerMoved"
                        PointerPressed="handlePointerPressed"/>

    private void handlePointerMoved(object sender, PointerEventArgs e)
    {
    	//handle mousedown events
    	if (currentPointerStatus == PointerStatus.PRESSED)
    	{
    		//Capture pointer movement and render stuff onto canvass
    	}
    }
    
    private void handlePointerReleased(object sender, PointerEventArgs e)
    {
    	setCurrentPointerStatus(PointerStatus.RELEASED);
    	//Plus do a whole bunch of other things
    }
    
    private void handlePointerPressed(object sender, PointerEventArgs e)
    {
    	setCurrentPointerStatus(PointerStatus.PRESSED);
    	//Plus do a whole bunch of other things
    }

    Thanks once again.

    Thursday, March 1, 2012 6:16 PM
  • Hi higgenkreuz,

    I can't reproduce this on the Consumer Preview. I added your Xaml and event handlers which reported the ID of the pointer sending them to debug output and always received the PointerReleased event regardless of whether the mouse was moving or not.

    You can use PointerPoint.GetCurrentPoint to access the status of a specific PointerID. If you keep track of the specific PointerIDs being tracked in PointerPressed then it will be easier for you to enable full touch input rather than being restricted to just the mouse.

    --Rob

    Friday, March 2, 2012 1:34 AM
    Moderator
  • Hello,

    I have the same bug in the latest preview of windows 8, installed last week.

    pointer press, moved are fired, released is not fired.

    it is annoying. I don't know how I can turn around the bug.

    Olivier

    Sunday, June 10, 2012 9:11 PM
  • Hi

    I have the same bug with button component pointer press, moved are fired, released is not fired.

    horrow ;-(

    Niko

    Friday, June 29, 2012 12:31 PM