disp_textT_disp_textDispTextDispText (Operator)

Name

disp_textT_disp_textDispTextDispText — Display text in a window.

Signature

disp_text( : : WindowHandle, String, CoordSystem, Row, Column, Color, GenParamName, GenParamValue : )

Herror T_disp_text(const Htuple WindowHandle, const Htuple String, const Htuple CoordSystem, const Htuple Row, const Htuple Column, const Htuple Color, const Htuple GenParamName, const Htuple GenParamValue)

void DispText(const HTuple& WindowHandle, const HTuple& String, const HTuple& CoordSystem, const HTuple& Row, const HTuple& Column, const HTuple& Color, const HTuple& GenParamName, const HTuple& GenParamValue)

void HWindow::DispText(const HTuple& String, const HString& CoordSystem, const HTuple& Row, const HTuple& Column, const HTuple& Color, const HTuple& GenParamName, const HTuple& GenParamValue) const

void HWindow::DispText(const HString& String, const HString& CoordSystem, Hlong Row, Hlong Column, const HString& Color, const HTuple& GenParamName, const HTuple& GenParamValue) const

void HWindow::DispText(const char* String, const char* CoordSystem, Hlong Row, Hlong Column, const char* Color, const HTuple& GenParamName, const HTuple& GenParamValue) const

void HWindow::DispText(const wchar_t* String, const wchar_t* CoordSystem, Hlong Row, Hlong Column, const wchar_t* Color, const HTuple& GenParamName, const HTuple& GenParamValue) const   (Windows only)

static void HOperatorSet.DispText(HTuple windowHandle, HTuple stringVal, HTuple coordSystem, HTuple row, HTuple column, HTuple color, HTuple genParamName, HTuple genParamValue)

void HWindow.DispText(HTuple stringVal, string coordSystem, HTuple row, HTuple column, HTuple color, HTuple genParamName, HTuple genParamValue)

void HWindow.DispText(string stringVal, string coordSystem, int row, int column, string color, HTuple genParamName, HTuple genParamValue)

Description

disp_textdisp_textDispTextDispTextDispText displays text in the graphics window WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle at the position (RowRowRowRowrow,ColumnColumnColumnColumncolumn).

If only a single position is defined, one text line is displayed for each element of StringStringStringStringstringVal. Also, '\n'"\n""\n""\n""\n" will be interpreted as a newline character, i.e., a line break is performed.

If multiple positions are defined, only a single string or one string for each position is allowed in StringStringStringStringstringVal. In this case, line breaks have to be forced with '\n'"\n""\n""\n""\n".

Newlines ('\n'"\n""\n""\n""\n") at the end of StringStringStringStringstringVal are ignored.

The position of the text may be specified in window coordinates (CoordSystemCoordSystemCoordSystemCoordSystemcoordSystem = 'window'"window""window""window""window") or in image coordinates (CoordSystemCoordSystemCoordSystemCoordSystemcoordSystem = 'image'"image""image""image""image"), which is useful when using zoomed images.

In addition to supplying (RowRowRowRowrow,ColumnColumnColumnColumncolumn) coordinates, it is also possible to pass predefined values to RowRowRowRowrow and ColumnColumnColumnColumncolumn to display the text at a fixed Position in the window (only if CoordSystemCoordSystemCoordSystemCoordSystemcoordSystem = 'window'"window""window""window""window").:

'top'"top""top""top""top", 'left'"left""left""left""left" 'top'"top""top""top""top", 'center'"center""center""center""center" 'top'"top""top""top""top", 'right'"right""right""right""right"
'center'"center""center""center""center", 'left'"left""left""left""left" 'center'"center""center""center""center", 'center'"center""center""center""center" 'center'"center""center""center""center", 'right'"right""right""right""right"
'bottom'"bottom""bottom""bottom""bottom", 'left'"left""left""left""left" 'bottom'"bottom""bottom""bottom""bottom", 'center'"center""center""center""center" 'bottom'"bottom""bottom""bottom""bottom", 'right'"right""right""right""right"

The parameter ColorColorColorColorcolor also accepts tuples of values. In that case, the specified colors are used cyclically for every new text position or for every new textline if a single position is used.

Generic Parameters

disp_textdisp_textDispTextDispTextDispText may display the StringStringStringStringstringVal within a box (default). This behavior and the look of the box are defined with the generic parameters in GenParamNameGenParamNameGenParamNameGenParamNamegenParamName and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue.

'box'

If 'box'"box""box""box""box" is set to 'true'"true""true""true""true", the text is written within a box. The look of the box and its optional shadow can be configured with the generic parameters below.

possible values: 'true'"true""true""true""true" and 'false'"false""false""false""false"

default value: 'true'"true""true""true""true"

'box_color'

Sets the color of the box.

possible values: a string containing the color name (e.g. 'white'"white""white""white""white", 'red'"red""red""red""red", or '#aa00bba0'"#aa00bba0""#aa00bba0""#aa00bba0""#aa00bba0")

default value: '#fce9d4'"#fce9d4""#fce9d4""#fce9d4""#fce9d4" (which is a light orange)

'shadow'

If 'shadow'"shadow""shadow""shadow""shadow" is set to 'true'"true""true""true""true", an additional shadow is displayed beneath the box (if 'box'"box""box""box""box" is 'true'"true""true""true""true").

possible values: 'true'"true""true""true""true" and 'false'"false""false""false""false"

default value: 'true'"true""true""true""true" if 'box_color'"box_color""box_color""box_color""box_color" is set to a color without alpha value, 'false'"false""false""false""false" otherwise

'shadow_color'

Sets the color of the shadow if 'shadow'"shadow""shadow""shadow""shadow" is 'true'"true""true""true""true".

possible values: a string containing the color name (e.g. 'black'"black""black""black""black", 'red'"red""red""red""red", or '#aa00bba0'"#aa00bba0""#aa00bba0""#aa00bba0""#aa00bba0")

default value: '#f28d26'"#f28d26""#f28d26""#f28d26""#f28d26" (which is a darker orange) if 'box_color'"box_color""box_color""box_color""box_color" is not set, 'white'"white""white""white""white" otherwise

'border_radius'

Controls the roundness of the box's corners. For sharp corners set it to 0, for smoother corners to higher values.

possible values: positive real numbers or 0

default value: 2

'box_padding'

Controls to which amount in pixels the box is extended around the text.

possible values: positive real number

default value: 0

'shadow_sigma'

Controls to which amount the shadow beneath the box is blurred. Set it to 0 for a sharp shadow.

possible values: positive real number or 0

default value: 1.5

'shadow_dx' and 'shadow_dy'

Controls the offset of the shadow in column ('shadow_dx'"shadow_dx""shadow_dx""shadow_dx""shadow_dx") and row ('shadow_dy'"shadow_dy""shadow_dy""shadow_dy""shadow_dy") direction in pixels.

possible values: any real number

default_value: 2

Attention

disp_textdisp_textDispTextDispTextDispText depends on the library libcanvas, which might not be available on embedded systems.

Execution Information

Parameters

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle (input_control)  window HWindow, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Window handle.

StringStringStringStringstringVal (input_control)  string(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

A tuple of strings containing the text message to be displayed. Each value of the tuple will be displayed in a single line.

Default value: 'hello' "hello" "hello" "hello" "hello"

CoordSystemCoordSystemCoordSystemCoordSystemcoordSystem (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

If set to 'window', the text position is given with respect to the window coordinate system. If set to 'image', image coordinates are used (this may be useful in zoomed images).

Default value: 'window' "window" "window" "window" "window"

List of values: 'image'"image""image""image""image", 'window'"window""window""window""window"

RowRowRowRowrow (input_control)  point.y(-array) HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

The vertical text alignment or the row coordinate of the desired text position.

Default value: 12

List of values: 12, 'bottom'"bottom""bottom""bottom""bottom", 'center'"center""center""center""center", 'top'"top""top""top""top"

ColumnColumnColumnColumncolumn (input_control)  point.x(-array) HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

The horizontal text alignment or the column coordinate of the desired text position.

Default value: 12

List of values: 12, 'center'"center""center""center""center", 'left'"left""left""left""left", 'right'"right""right""right""right"

ColorColorColorColorcolor (input_control)  string(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

A tuple of strings defining the colors of the texts.

Default value: 'black' "black" "black" "black" "black"

List of values: 'black'"black""black""black""black", 'blue'"blue""blue""blue""blue", 'coral'"coral""coral""coral""coral", 'cyan'"cyan""cyan""cyan""cyan", 'forest green'"forest green""forest green""forest green""forest green", 'green'"green""green""green""green", 'lime green'"lime green""lime green""lime green""lime green", 'magenta'"magenta""magenta""magenta""magenta", 'red'"red""red""red""red", 'slate blue'"slate blue""slate blue""slate blue""slate blue", 'yellow'"yellow""yellow""yellow""yellow"

GenParamNameGenParamNameGenParamNameGenParamNamegenParamName (input_control)  attribute.name-array HTupleHTupleHtuple (string) (string) (HString) (char*)

Generic parameter names.

Default value: []

List of values: 'border_radius'"border_radius""border_radius""border_radius""border_radius", 'box'"box""box""box""box", 'box_color'"box_color""box_color""box_color""box_color", 'box_padding'"box_padding""box_padding""box_padding""box_padding", 'shadow'"shadow""shadow""shadow""shadow", 'shadow_color'"shadow_color""shadow_color""shadow_color""shadow_color", 'shadow_dx'"shadow_dx""shadow_dx""shadow_dx""shadow_dx", 'shadow_dy'"shadow_dy""shadow_dy""shadow_dy""shadow_dy", 'shadow_sigma'"shadow_sigma""shadow_sigma""shadow_sigma""shadow_sigma"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue (input_control)  attribute.value-array HTupleHTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Generic parameter values.

Default value: []

List of values: 5.0, 'black'"black""black""black""black", 'blue'"blue""blue""blue""blue", 'false'"false""false""false""false", 'forest green'"forest green""forest green""forest green""forest green", 'red'"red""red""red""red", 'true'"true""true""true""true", 'white'"white""white""white""white"

Example (HDevelop)

dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
disp_text (WindowHandle, 'Display some text in a box', 'window', 12, 12, \
           'black', [], [])

Possible Predecessors

open_windowopen_windowOpenWindowOpenWindowOpenWindow, set_fontset_fontSetFontSetFontSetFont, get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtents

Alternatives

write_stringwrite_stringWriteStringWriteStringWriteString

See also

get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtents, set_fontset_fontSetFontSetFontSetFont

Module

Foundation