Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS ComputerControl Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /ComputerControl/MouseMover
This example is the version from Sun, 17th Mar 2012.
Project "MouseMover.xojo_binary_project"
Class Fenster1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
EventHandler Function MouseDown(X As Integer, Y As Integer) As Boolean
beep
me.refresh
End EventHandler
EventHandler Sub MouseEnter()
inside=true
End EventHandler
EventHandler Sub MouseExit()
inside=false
End EventHandler
EventHandler Sub Paint(g As Graphics)
g.foreColor=rgb(rnd*256,rnd*256,rnd*256)
g.fillrect 0,0,g.width,g.height
End EventHandler
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control MouseUpTimer Inherits Timer
ControlInstance MouseUpTimer Inherits Timer
EventHandler Sub Action()
MouseDown
MouseUp
End EventHandler
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
EventHandler Function KeyDown(Key As String) As Boolean
dim x,y as integer
StaticText6.text=str(asc(key))
if asc(key)=28 then // cursor left
x=system.mouseX
y=system.mousey
x=x-10
Mousemove x,y
return true
end if
if asc(key)=29 then // cursor right
x=system.mouseX
y=system.mousey
x=x+10
Mousemove x,y
return true
end if
if asc(key)=30 then // cursor up
x=system.mouseX
y=system.mousey
y=y-10
Mousemove x,y
return true
end if
if asc(key)=31 then // cursor down
x=system.mouseX
y=system.mousey
y=y+10
Mousemove x,y
return true
end if
if asc(key)=27 then // center on escape
x=screen(0).width/2
y=screen(0).height/2
Mousemove x,y
return true
end if
if asc(key)=32 then // click on space
MouseDown
if MouseUpTimer.mode=0 then
MouseUpTimer.mode=1 // mouseup after mousedown
return true
end if
end if
End EventHandler
Protected Sub MouseDown()
dim x,y as integer
x=System.mousex
y=system.mousey
if targetwin32 then
call remoteControlMBS.winmouseClick x,y,true,true
elseif targetmachO then
call remoteControlMBS.MacMouseClick x,y, true, true
elseif targetlinux then
call remoteControlMBS.linuxMouseClick(1,true)
else
msgBox "not supported"
end if
End Sub
Protected Sub MouseMove(x as integer, y as integer)
title="Move "+str(x)+"/"+str(y)
if targetwin32 then
call remoteControlMBS.winmoveMouse x,y
elseif targetmachO then
call remoteControlMBS.MacMoveMouse x,y
elseif targetlinux then
call remoteControlMBS.linuxMoveMouse x,y
else
msgBox "not supported"
end if
End Sub
Protected Sub MouseUp()
dim x,y as integer
x=System.mousex
y=system.mousey
if targetwin32 then
call remoteControlMBS.winmouseClick x,y,true,false
elseif targetmachO then
call remoteControlMBS.MacMouseClick x,y, true, false
elseif targetlinux then
call remoteControlMBS.linuxMouseClick(1,false)
else
msgBox "not supported"
end if
End Sub
Property inside As boolean
End Class
MenuBar Menü
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "Ablage"
MenuItem FileQuit = "Beenden"
MenuItem UntitledMenu0 = "Bearbeiten"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Ausschneiden"
MenuItem EditCopy = "Kopieren"
MenuItem EditPaste = "Einfügen"
MenuItem EditClear = "Löschen"
End MenuBar
Class App Inherits Application
End Class
End Project
The items on this page are in the following plugins: MBS ComputerControl Plugin.