Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Windows Touch Events
This example is the version from Fri, 31th Mar 2016.
Project "Windows Touch Events.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
EventHandler Sub Action()
if WinPointerEventsMBS.EnableMouseInPointer(me.Value) then
if me.Value then
me.Enabled = False // you can only use it once.
end if
end if
End EventHandler
End Control
Control LogList Inherits Listbox
ControlInstance LogList Inherits Listbox
End Control
EventHandler Sub Close()
if p <> nil then
p.list = nil
p.close
p = nil
end if
End EventHandler
EventHandler Sub Open()
#if TargetWin32 then
p = new myWinPointerEventsMBS(self)
p.list = LogList
dim c as new WinGestureConfigMBS
c.ID = 0
c.Want = c.kAllGestures
if WinPointerEventsMBS.SetGestureConfig(self, array(c)) then
// ok
else
MsgBox "SetGestureConfig failed"
end if
#else
MsgBox "This example is only for Windows."
#endif
End EventHandler
Property p As MyWinPointerEventsMBS
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MyWinPointerEventsMBS Inherits WinPointerEventsMBS
EventHandler Function Gesture(info as WinGestureInfoMBS) As boolean
log CurrentMethodName
Select case info.ID
case info.kGestureIDBegin
log "Begin"
case info.kGestureIDEnd
log "End"
case info.kGestureIDPan
log "Pan"
case info.kGestureIDPressAndTap
log "PressAndTap"
case info.kGestureIDRotate
log "Rotate "+str(info.RotateAngle)
case info.kGestureIDTwoFingerTap
log "TwoFingerTap"
case info.kGestureIDZoom
log "Zoom"
end Select
log "Location: "+str(info.LocationX)+"/"+str(info.Locationy)
End EventHandler
EventHandler Sub GestureNotify()
log CurrentMethodName
End EventHandler
EventHandler Function PointerDeviceChange(Change as Integer, Param as Integer) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function PointerDeviceInRange(Param1 as Integer, Param2 as Integer) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function PointerDeviceOutOfRange(Param1 as Integer, Param2 as Integer) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function PointerDown(PointerID as Integer, Flags as Integer, X as Integer, Y as Integer, info as WinPointerInfoMBS) As boolean
log CurrentMethodName+" ID: "+str(PointerID)+" at "+str(x)+"/"+str(y)
End EventHandler
EventHandler Function PointerEnter(PointerID as Integer, Flags as Integer, X as Integer, Y as Integer, info as WinPointerInfoMBS) As boolean
log CurrentMethodName+" ID: "+str(PointerID)+" at "+str(x)+"/"+str(y)
Select case info.pointerType
case info.kTypePointer
log "PointerType: Pointer"
case info.kTypeTouch
log "PointerType: Touch"
case info.kTypePen
log "PointerType: Pen"
case info.kTypeMouse
log "PointerType: Mouse"
case info.kTypeTouchpad
log "PointerType: Touchpad"
end Select
End EventHandler
EventHandler Function PointerHWheel(PointerID as Integer, Delta as Integer, X as Integer, Y as Integer, info as WinPointerInfoMBS) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function PointerLeave(PointerID as Integer, Flags as Integer, X as Integer, Y as Integer, info as WinPointerInfoMBS) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function PointerUp(PointerID as Integer, Flags as Integer, X as Integer, Y as Integer, info as WinPointerInfoMBS) As boolean
log CurrentMethodName+" ID: "+str(PointerID)+" at "+str(x)+"/"+str(y)
End EventHandler
EventHandler Function PointerUpdate(PointerID as Integer, Flags as Integer, X as Integer, Y as Integer, info as WinPointerInfoMBS) As boolean
log CurrentMethodName+" ID: "+str(PointerID)+" at "+str(x)+"/"+str(y)
End EventHandler
EventHandler Function PointerWheel(PointerID as Integer, Delta as Integer, X as Integer, Y as Integer, info as WinPointerInfoMBS) As boolean
log CurrentMethodName
End EventHandler
Sub log(s as string)
list.AddRow s
list.ScrollPosition = list.ListCount
End Sub
Property list As Listbox
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Win Plugin.