Example: /ComputerControl/Presskey Class Example

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/ComputerControl/Presskey Class Example


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/Presskey Class Example

This example is the version from Sun, 23th Sep 2017.

Project "Presskey Class Example.xojo_binary_project"
Class Window1 Inherits Window
Control EditField1 Inherits TextField
ControlInstance EditField1 Inherits TextField
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() ' You find the codes in your Xojo docs ' the same keycodes like for the spritesurface! dim p as PresskeyMBS p=new PresskeyMBS p.shift=true p.charcode=asc("H") p.keycode=4 p.press 'press H p.shift=false p.charcode=asc("e") p.keycode=14 p.press 'press e p.charcode=asc("l") p.keycode=37 p.press 'press l p.press 'press l p.charcode=asc("o") p.keycode=31 p.press 'press o End EventHandler
EventHandler Sub Open() me.enabled=targetmacOS End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() ' You find the codes in your Xojo docs ' the same keycodes like for the spritesurface! dim p as PresskeyMBS p=new PresskeyMBS p.charcode=0 p.keycode=&h38 p.pressraw true 'shift down p.charcode=asc("H") p.keycode=4 p.pressraw true 'press H p.pressraw false p.charcode=0 p.keycode=&h38 p.pressraw false 'shift up p.charcode=asc("e") p.keycode=14 p.pressraw true 'press e p.pressraw false p.charcode=asc("l") p.keycode=37 p.pressraw true 'press l p.pressraw false p.pressraw true 'press l p.pressraw false p.charcode=asc("o") p.keycode=31 p.pressraw true 'press o p.pressraw false End EventHandler
EventHandler Sub Open() me.enabled=targetmacOS End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action() ' -1 is for this plugin the automatic mode dim p as PresskeyMBS editfield1.setfocus 'so we get something in it! p=new PresskeyMBS p.shift=true p.charcode=asc("H") p.virtualCode=-1 'automatically try to get this code p.press 'press H p.shift=false p.virtualCode=-1 'after a call you find the virtualCode there p.charcode=asc("e") p.press 'press e p.virtualCode=-1 p.charcode=asc("l") p.press 'press l p.press 'press l p.virtualCode=-1 p.charcode=asc("o") p.press 'press o End EventHandler
EventHandler Sub Open() me.enabled=targetwin32 End EventHandler
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action() dim p as PresskeyMBS dim k as KeyCodesMBS k=new KeyCodesMBS p=new PresskeyMBS p.command=true p.charcode=asc("q") p.Keycode=k.AsciiToKeyCode(asc("q")) 'p.keycode=12 'from the table for SpriteSurface keycodes p.virtualCode=-1 'auto generate VirtualCode on Windows p.press End EventHandler
End Control
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

The items on this page are in the following plugins: MBS ComputerControl Plugin.


💬 Ask a question or report a problem