User Guide
Ruby Component
Mouse Capture & Dragging
If you want to handle drag operations, where the user clicks, holds then moves the cursor, you will need to capture the mouse. To do this you
call the captureMouse method. This should be done in response to a mouse down event.
Now, so long as the mouse button remains down FlowBotics Studio will look for a method called mouseMoveCaptured in your Ruby
component. If it exists it will be called each time you move the mouse.
When the mouse button is released you'll get a call to the appropriate mouse up method. From this method you will need to call the
releaseMouse method.
All this is much better illustrated in an example:
Here we've extended the previous example to send the coordinates of the mouse pointer only while you drag the mouse.
Key Modifiers
Sometimes you want to define different responses to clicks and drags based on whether a particular key modifier has been applied. Most
commonly you'll want to check whether the SHIFT, CTRL or ALT keys are pressed at the time of or during interaction.
To do this we have the isKeyPressed method:
isKeyPressed keyName
The method has one input, the keyName. This can be either a string representing the key or an integer representing the virtual key code.
So to check the 'q' key, use “q” or the virtual key code of 81 as the key name. You can find a list of virtual key codes here:
http://msdn.microsoft.com/en-us/library/aa243025(v=vs.60).aspx
The method will return true or false depending on whether the key is currently pressed or not.
Special Keys
For some special, frequently used keys we have setup shortcut strings to save you having to look up the virtual key codes:
Key Key Name String to Use (case insensitive)
Shift “Shift”
Control “Control” or “CTRL”
Alt “Alt”
150 of 212