Iphone mouse with double-click

Previous topic - Next topic

ampos

Use this if you want to read iPhone screen touch or want to emulate iphone screen on desktop PC.

Code (glbasic) Select

TYPE Mouse
   x
   y
   b1
   b2
   bl
ENDTYPE

GLOBAL mouse AS Mouse

SUB imouse:
MOUSESTATE mx,my,b1,b2

IF b1=0 AND mouse.b1<>0 THEN mouse.bl=0

IF b1=0
mouse.b1=0
INC mouse.bl
ENDIF

IF b1=1
mouse.x=mx
mouse.y=my
IF mouse.bl<10
mouse.b1=2
ELSE
mouse.b1=1
ENDIF
ENDIF

ENDSUB


This function will return:

mouse.x = x coord
mouse.y = y coord
mouse.b1 = 1 = left single click
mouse.b1 = 2 = left double click
mouse.b2 = 1 = right single click

mouse.x & mouse.y will return the last known mouse coordinates (the ones where you clicked)

In the line
   IF mouse.bl<10
you can change the 10 number for faster/slower double click delay

Thanks to backslider for the original one.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE