I found a project that was easy to strip down to a simple demo as MainWindow0 (MW0). In it the window is blue until you click and it turns white and touches are shown while pinning the cursor. Click again to turn blue and be able to move the cursor. This lets you touch all around without the cursor getting in the way (but as I alluded to before certain touch patterns slip through).
Realizing you probably aren’t making a custom gesture there’s a simpler MainWindow1, it’s code below. All it does is turn on receiving touches, store them and draw them.
[code]Private lastTouches() As TouchableView.TouchData //for storing the most recent touches received
Sub Open(byref useMagnify As boolean, byref useRotate As boolean, byref useTouch As boolean)
useTouch = true //must turn on the feature in the Open event
End Sub
Function TouchDown(touches() As TouchableView.TouchData, x As integer, y As integer) As boolean
lastTouches = touches //store
me.Invalidate //redraw
return false //don’t (pin cursor and begin TouchDrag)
End Function
Sub Paint(g As Graphics, areas() As REALbasic.Rect)
g.ForeColor = &cFFFFFF //fill
g.FillRect(0, 0, g.Width, g.Height)
g.ForeColor = &c00FF00
dim t As TouchableView.NSPoint
for i As integer = 0 to lastTouches.Ubound //for each Touch received
t = lastTouches(i).pos //get it’s xy point
g.FillRect(t.x * g.Width - 20, g.height * (1-t.y) - 20, 40, 40) //draw it centered 40x40
next
g.ForeColor = &c808080 //outline
g.DrawRect(0, 0, g.Width, g.Height)
End Sub[/code]
MainWindow2 adds the Magnify gesture with touch drawing. Sorry there’s no docs, hope it’s simple enough to be self explanatory.
http://home.comcast.net/~trochoid/code/TouchDemo.xojo_binary_project.zip