TextControlEx

www.progui.co.uk  Top  Previous  Next

TextControlEx()

Syntax

WindowsID = TextControlEx(Window.i, ID.l, X, Y, Width.l, Height.l, Text$, Flags.l)

Description

Displays a text label (transparent by default) in the specified Window.

ID specifies the internal ID of the text label and if #ProGUI_Any is used then the returned value will be the new TextControlEx ID. X, Y, Width and Height are the position and dimensions of the label in the window. If Width or Height are null then the corresponding dimensions are calculated automatically. Text$ specifies what is displayed in the label. Flags can include the following:

Flag

Description

#TCX_BK_FILL

background is a solid fill. see SetTextControlExColour

#TCX_BK_GRADIENT

background is a gradient fill. see SetTextControlExGradient

#TCX_CENTRE

text is centered horizontally

#TCX_RIGHT

text is right aligned

#TCX_VCENTRE

text is centered vertically

#TCX_END_ELLIPSIS

if the end of a line of text does not fit in the specified width/height dimensions, it is truncated and ellipses are added.

#TCX_PATH_ELLIPSIS

If a text line contains backslash ('\', escapecode: '\\') characters in a block (e.g. a file path), #TCX_PATH_ELLIPSIS preserves as much as possible of the text after the last backslash by replacing characters in the middle of the line with ellipses so that the result fits in the specified width/height dimensions.

#TCX_DISABLE_ESCAPECODES

disables processing and rendering of escape codes.

#TCX_IGNORE_COLOR_ESCAPECODE

ignores rendering of colour escape codes, useful for displaying all text as one colour for example, a disabled state.

Text$ can also contain the following "escape code" effects: -

 

Escape Code

Description

Example

\b

Applies the Bold effect to any text after this escape code.

"This is an \bexample\b label"

\i

Applies the Italic effect to any text after this escape code.

"This is an \iexample\i label"

\u

Applies the Underline effect to any text after this escape code.

"This is an \uexample\u label"

\s

Applies the Strike Through effect to any text after this escape code.

"This is an \sexample\s label"

\c

Changes the colour of any text after this escape code. The escape code should be followed by 6 characters representing the hexadecimal value of the colour. '\n' should be used to cancel the colour.

"This is an \cff0000example\n label"

\n

This escape code cancels any active effects and displays the preceding text as Normal.

"This is an \u\bexample\n label"

\|

New line escape code, any preceding text is on a new line.

"This is the first line!\|Second line!"

\l

The Link escape code allows you to include hyperlinks in the text. The escape code should be immediately followed by a numeric ID which will be used to identify the link.

 

Any text following the ID will be displayed as the link up until a single terminating "\l" link code is encountered. An optional "|" character can be placed in the link text in order to "divide" the text into text for normal state and text for the hover state.

 

When the link is clicked on or in the mouse hover state, ProGUI will send a #TCX_LINK_CLICK or #TCX_LINK_HOVER event message to the TextControlEx's parent window. The Wparam of the event message is the ID of the link that was clicked on or in the hover state.

Basic blue link example: -

 

"\l123\c0000ffthis is a link\n\l"

 

Blue link with underline hover state: -

 

"\l123\c0000ffthis is a link\n|\c0000ff\uthis is a link\n\l"

 

Returns the Windows ID of the TextControlEx (or if #ProGUI_Any is used the TextControlEx ID) or zero for failure.

 

Note: If a backslash ('\') needs to be displayed in Text$ then a double backslash ('\\') will display a single backslash.

 

TextControlEx Index