Detect a Single Tap on a Touchpad/Touchscreen

Windows specific questions.
Post Reply
CommanderRaven
Posts: 86
Joined: Jan 22, 2009 18:52
Location: Houston, tx

Detect a Single Tap on a Touchpad/Touchscreen

Post by CommanderRaven »

Does anyone have any code that can detect a single tap on a Touchpad or Touchscreen? The built in getmouse command in Free Basic cannot detect a single tap. To get a left click (IE Button = 1) one must double tap, or tap and slightly slide your finger. I'd like to be able to support a single tap in games I'm working on...

I'm not windows programmer. But I read something about the Windows Touch.api might do this.

Ideally, I'd like a know the x, y position of the tap. But I can get this with Getmouse, if I can detect a single tap...

Thanks!
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Detect a Single Tap on a Touchpad/Touchscreen

Post by counting_pine »

Perhaps the problem is that the mouse "button" is not held down long enough for GetMouse to register it.
Maybe you could do it using ScreenEvent? You might have to change the general way you handle events though..
CommanderRaven
Posts: 86
Joined: Jan 22, 2009 18:52
Location: Houston, tx

Re: Detect a Single Tap on a Touchpad/Touchscreen

Post by CommanderRaven »

Awesome! Saved my ass again CP!

Yep, i'll have to completely redo my code for mouse dectection, but I should be able to use the example code in the manual to do this single tap. I've tested the same code on my tablet, and I can detect a mouse tap with the screenevent. It shows up as a left click down, left click up. I think you are right, getmouse just isn't detecting it. I'm thinking, I might be able to just hack my getmouse results... hmmm... thanks for pointing this out. Now I can get the tap working.

The good news this will make a tablet version of Moria work as well. Can't wait to get working on the next version.... Very cool indeed....
Post Reply