The structures representing callbacks for system calls are exposed by the available user interface components.
See FBEvent
.
For derivatives of the pyfbsdk::FBVisualComponent
class, there are various callback structures for all the events that can occur.
Once the callback function has been assigned, the event can be accessed in certain cases to get information about the event itself.
Callbacks can be registered in the Python UI. All callbacks have the same signature: FunctionName(eventsource, event)
; eventsource
is the object (for example a button) in which you register the callback, and event
is the object that contains all information about the event that was triggered. See the code snippet below:
def mycallback(control, event):
print control + " was clicked"
button.OnClick.Add(mycallback)
FBEventInput converts a generic event into an input event. The input event lets you access the state of the keyboard or mouse (what keys or buttons are being pressed).
FBEventSpread contains the row and column of the cell that received the event. The spread event structure gives you access to the row and column number where the event occurs.
FBEventDragAndDrop contains the stack of items as well as the current position of the mouse for a drag and drop event. Drag and drop events are complex in nature because the manipulations that can be done vary depending on the current state of the input. A user interface element can be a generator and/or a receiver for a drag and drop. In the case of a generator, the element can have items dragged from it, whereas a receiver can have items dropped (added) into it. Only the following support drag and drop: FBList (of type kFBVerticalList), FBContainer, FBSpread.
The class FBView lets you integrate an OpenGL window into a plug-in. With this functionality, you are responsible for taking care of the correct refresh/update calls to correctly manage the different data structures that are accessed by the OpenGL view.
On top of the particulars of the FBView class, the ability to overload the FBVisualComponent and the FBComponent functions give you control over your user interface element.
The basic functions used to overload are: FBVisualComponent::ViewExpose, the display function of the window. OpenGL calls should be made in this thread, as it is called by the rendering engine, which has the created view assigned in the rendering queue; FBVisualComponent::ViewInput: Called whenever the mouse is dragged over the view.
Attributes inherited from FBVisualComponent can also be accessed to reconfigure and add user interface elements.