Skip to content

WaynesTextBoxState class ​

A bundle of the style objects that describe a single visual state of a WaynesTextBox. Each textbox holds three parallel instances (NormalState, HoverState, FocusedState); the textbox picks one at each repaint depending on the focus / hover state.

In addition to the usual background / borders / corners / text-rendering quartet, a WaynesTextBoxState adds selection-highlight colours, a caret colour and width, and three decorator fills used for the ERROR / WARNING / INFO literal-substring decorations the textbox draws automatically.

InitializeDefaultValues and InitializeDefaultValues_Focused populate the state with reasonable defaults --- the focused variant uses a different selection background and caret colour.

The type itself is Public Class but is [COMCreatable(False)] --- instances are accessed only through the textbox's NormalState / HoverState / FocusedState properties.

Properties ​

BackgroundFill ​

The Fill that paints the textbox background. Defaults to solid white.

Borders ​

The Borders drawn around the textbox. Defaults to a 1-pixel black border.

CaretFill ​

The Fill that paints the caret. Defaults to solid black in the normal state, orange in the focused state.

CaretWidth ​

The width of the caret, in pixels. Long. Default: 1.

Corners ​

The Corners that controls the per-corner shape and radius. Defaults to tbCurve with a radius of 5.

DecorationERROR ​

The Fill used to draw the inline squiggle decoration when the substring ERROR is detected in Value. Defaults to solid red.

DecorationINFO ​

The Fill used to draw the inline background-highlight decoration when the substring INFO is detected in Value. Defaults to a light blue.

DecorationWARNING ​

The Fill used to draw the inline 2-pixel straight-underline decoration when the substring WARNING is detected in Value. Defaults to a dark blue.

SelectedBackgroundFill ​

The Fill that paints behind selected text. Defaults to mid-grey in the normal state, blue in the focused state.

SelectedTextFill ​

The Fill that paints the selected glyphs themselves. Defaults to solid white.

TextRendering ​

The TextRendering that controls how Value is drawn. Defaults to left-aligned with 5-pixel left / right padding and tbDisallowPartialChars overflow.

Methods ​

InitializeDefaultValues ​

Populates every field with the package defaults --- used by NormalState and HoverState.

Syntax: object.InitializeDefaultValues

InitializeDefaultValues_Focused ​

Calls InitializeDefaultValues first, then overrides SelectedBackgroundFill and CaretFill with focus-specific colours.

Syntax: object.InitializeDefaultValues_Focused

Events ​

OnChanged ​

Raised whenever any of the contained style objects raises its own OnChanged, or when CaretWidth is assigned. The parent WaynesTextBox listens for this and requests a repaint.

twinBASIC and LOGO copyright of "WaynePhillipsEA" author