MouseTouchDevice problem, please help

Dec 22, 2011 at 3:10 PM

Hello
Im trying to find some way to do what Blake.NUI.WPF.Touch.MouseTouchDevice.RegisterEvents(this); do.
Is really awesome, due finally I can add mouse functionality to my appz, without have to add tonz of code.

I start test this, and work ok with mouse, the objects on my appz are multitouch, now respond to mouse but i see one problem now.

I have some buttons now work wrong ok with mouse but incorrectly with touch.

My button is a  simple button created with touch_down:

    private void button_TouchDown(object sender, TouchEventArgs e)
        {

            if (varbutton == false)
            {
                varbutton = true;

                //action when button is on
         
            }
            else
            {
                varbutton = false; 

                //action when button is off
     
            }
        }


This is a simple button 2 sattes, when touch_down button is ON, whe touchdown again, button is OFF.
Using MouseTouchDevice.RegisterEvents cause malfuction of button.
When use mouse is ok, but when touch the screen, 2 events are sended,!!!

Why this happen?
Im working with Windows 8, simple wpf project, windows 8 improve all the touch engine,  can be this related?
Please can somebody test this and tell me why this happen?

Best regards.




Jan 4, 2012 at 7:41 AM

I already find a workaround for this  :)

Coordinator
Jan 4, 2012 at 6:23 PM

GrobotoX wrote:
This is a simple button 2 sattes, when touch_down button is ON, whe touchdown again, button is OFF.
Using MouseTouchDevice.RegisterEvents cause malfuction of button.
When use mouse is ok, but when touch the screen, 2 events are sended,!!!


Make sure you set e.Handled = true. The regular TouchDevice will be promoted to a MouseDevice and mouse events if the event is unhandled. My MouseTouchDevice (or NativeTouchDevice) does not re-promote to mouse events, though. This may be why you are seeing double events.

Jan 4, 2012 at 6:28 PM

Thak you for repply, but i already have this working, please can take a look on this:

http://blakenui.codeplex.com/discussions/284911

Thankyou for this lib Joshua saveme a lot of hours of work!!!

Coordinator
Jan 4, 2012 at 6:34 PM

Yes, I was just replying here as well for the benefit of other forum readers. If you have a different solution than what I posted, please share it so it can help others. :)