Programming Reference:TextField Class

From BCI2000 Wiki
Jump to: navigation, search




The TextField class represents a rectangle on a GraphDisplay that contains text.


TextField(GraphDisplay, int zOrder=MessageZOrder)

In the constructor, specify the target display, and optionally a z order value.


Makes the object visible. Initially, objects are created in visible state.


Makes the object invisible.


Invalidates the object's bounding rectangle, i.e. marks it as needing to be repainted. Typically, this function is called from a derived class, indicating that a change in object properties has occurred that requires a repaint.


Asks an object to paint itself by calling its OnPaint event handler.


Notifies an object of a change in display properties by calling its OnChange event handler.

bool Click(GUI::Point)

Tests whether the specified point is inside an object's bounding rectangle, and calls its OnClick event handler if this is the case.


string Text

The text to be displayed.

float TextHeight

The text height in units of text field height. Typically, this would be between 0.6 and 0.8.

RGBColor TextColor

The color used to draw text.

RGBColor Color

The text field's background color.

GraphDisplay Display (r)

The GraphDisplay object that was specified when the object was created.

bool Visible (r)

True if the object is visible, false if it is hidden. Use the Hide() and Show() methods to set this property.

float ZOrder (rw)

Determines the order in which GraphObjects are drawn. GraphObjects with smaller values of ZOrder are drawn on top of those with larger values, hiding these.

enum AspectRatioMode (rw)

One of the following options:

No adjustment is made.
The object's width is adapted to its contents, while keeping its height constant.
The object's height is adapted to its contents, keeping its width constant.
Both the object's height and width are adjusted to its content.

The exact behavior of aspect ratio adjustment depends on the object's type. E.g., for bitmap images, AdjustBoth will size the image such that one image pixel corresponds to one screen pixel; AdjustHeight and AdjustWidth will adjust such that the original aspect ratio is preserved.

GUI::Rect DisplayRect (rw)

The bounding rectangle of the space that is occupied by the object. This is given in coordinates relative to the size of the object's GraphDisplay; there, the upper left corner corresponds to (0,0), the lower right corner to (1,1). When a GraphObject is created, its display rectangle is empty.

See also

Programming Reference:GraphObject Class, Programming Reference:GraphDisplay Class, Programming Reference:TextStimulus Class