User Guide

Ruby Component
Drawing
As well as handling data the Ruby component can also be used to handle mouse events and draw to a front panel. This section covers
drawing and the next handles mouse interaction.
To enable your Ruby component to draw to a front panel you need to add a View input connector and then link this to a View output
connector from an MGUI (either directly or by a series of links) or from a Wireless Input that connects to a front panel in a module above.
Once you have this set up you can start responding to draw requests from FlowBotics Studio.
The draw Method
To respond to redraw requests from FlowBotics Studio you'll need to define a draw method. FlowBotics Studio looks for this whenever
drawing messages arrive at a View connector on a Ruby component.
The method can have an optional input connector reference parameter (if you're handling multiple View connectors on the same Ruby
component) followed by a mandatory View parameter.
The View parameter is an instance of the View class. This is a Ruby class that references the front panel and allows you to draw to it. Think
of it as the drawing surface.
Drawing Classes and Methods
Drawing is performed by calling methods of the View object. There are also a number of Classes which represent drawing objects.
All the methods and classes you'll use are wrappers onto Microsoft's Gdi+ graphics library. There are some minor variations but in general
they map directly onto the methods and classes of Gdi+. There are many resources online dedicated to this so if you need any further help
or examples you should be able to look these up and translate them directly into the FlowBotics Studio equivalents.
117 of 212