public sealed class TextField : BarItem
A text box on a toolbar.

Constructors

TextField

#
Create a new toolbar text field.
public TextField(
icon,
nomen,
initial
)

Properties

Active

#
Gets or sets whether this text field is active.
public bool Active { get; set; }

AdjacentOnLeftSide

#
public override bool AdjacentOnLeftSide { get; }

AdjacentOnRightSide

#
public override bool AdjacentOnRightSide { get; }

Bar

Gets the toolbar this element is hosted on. This field may be null, but will be assigned by the Bar itself once this element is added to it.
public Bar Bar { get; }
inherited fromBarItem

Bounds

Gets the visible bounds for this element. These bounds are set by the BarItem.Bar during layout.
public Rectangle Bounds { get; }
inherited fromBarItem

Enabled

Gets or sets whether this element is enabled. Note that if the parent toolbar is disabled, this element is disabled by implication. Thus, use the BarItem.IsEnabled() function to determine the real state.
public bool Enabled { get; set; }
inherited fromBarItem

EnterPressed

#
public Action EnterPressed { get; set; }

EscapePressed

#
public Action EscapePressed { get; set; }

Icon

Gets the icon, if any, associated with this element.
public IIcon Icon { get; }
inherited fromBarItem

KeyCode

Gets or sets the shortcut key for this element. Whether or not this is actually used depends on the form hosting this toolbar.
public BarShortcut KeyCode { get; set; }
inherited fromBarItem

MaximumWidth

Gets the maximum width (in logical pixels) for this element.
public int MaximumWidth { get; }
inherited fromBarItem

MinimumWidth

Gets the minimum width (in logical pixels) for this element.
public int MinimumWidth { get; }
inherited fromBarItem

Nomen

Gets the nomen describing this element.
public Nomen Nomen { get; }
inherited fromBarItem

OffColour

Gets or sets the colour associated with the Off state, whenever meaningful.
public Color? OffColour { get; set; }
inherited fromBarItem

OnColour

Gets or sets the colour associated with the On state, whenever meaningful.
public Color? OnColour { get; set; }
inherited fromBarItem

Optional

#
Gets or sets whether this textfield is optional. I.e. whether the user can toggle the Active state.
public bool Optional { get; }

Placeholder

#
Gets or sets the placeholder text.
public string Placeholder { get; set; }

Prefix

#
Gets or sets a label drawn against the left edge of the field, faded, outside the editable text. Unlike the Suffix - which belongs to the value and travels with it - a prefix holds still, which is what makes it usable as a caption ("min", "max") in place of a separate label on the panel.
public string Prefix { get; set; }

Suffix

#
Optional annotation drawn immediately after the text in a faded version of the text colour, typically a unit, i.e. " seconds". Include the leading space for breathing room.

This is decoration, not content: it is never typed into, selected, measured for the caret, or handed to Validator. It says what the value means, and it is not drawn at all while the Placeholder is showing.

public string Suffix { get; set; }

Text

#
public Prose.TextWithCaret Text { get; }

Validator

#
Optional validity test for the current text. When set and the (non-empty) text fails it, the field is drawn in a warning colour. Purely visual — it does not block typing; callers decide separately whether to act on the value.
public Func<string, bool> Validator { get; set; }

Methods

ClearSquiggle

#
Remove the squiggle previously set by SetSquiggle(MessageLevel, string, string).
public void ClearSquiggle()

CreateOutline

protected GraphicsPath CreateOutline()
inherited fromBarItem

CreateOutline

Create a new graphics path representing the outline of this item.
protected GraphicsPath CreateOutline(
roundedOnLeft,
True if path ought to have rounded corners on the left.
roundedOnRight
True if the path ought to have rounded corners on the right.
)
inherited fromBarItem

Draw

public void Draw(
context
)
inherited fromBarItem

DrawDisabled

#
protected override void DrawDisabled(
context
)

DrawFocus

#
protected override void DrawFocus(
context
)

DrawHover

#
protected override void DrawHover(
context
)

DrawIcon

Draw the icon (if any) into the given frame. An automatical 2-pixel paddding is created inside the frame.
protected bool DrawIcon(
context,
icon,
Rectangle
frame,
Color
background
)
inherited fromBarItem
True if an icon was drawn.

DrawIcon

Draw the icon (if any) into the given frame. An automatical 2-pixel paddding is created inside the frame.
protected bool DrawIcon(
context,
Rectangle
frame,
Color
background
)
inherited fromBarItem
True if an icon was drawn.

DrawIconAndText

protected bool DrawIconAndText(
context,
style,
text,
Color
background
)
inherited fromBarItem

DrawNormal

#
protected override void DrawNormal(
context
)

DrawText

Draw a string into the frame.
protected bool DrawText(
context,
Rectangle
frame,
text,
Color
background
)
inherited fromBarItem

FindGroupByChapter<T>

Collect all toolbar elements which share the same nomen chapter as this element. If there is only a single element (i.e. this one) then an empty array is returned.
protected T[] FindGroupByChapter<T>()
inherited fromBarItem

FindGroupBySection<T>

Collect all toolbar elements which share the same nomen section as this element, across every bar in the same Bar.Bundle. If there is only a single element (i.e. this one) then an empty array is returned.
protected T[] FindGroupBySection<T>()
inherited fromBarItem

HasNeighbourToTheLeft

Gets whether the item directly to the left of this item has an outline shape adjacent to this item.
protected bool HasNeighbourToTheLeft()
inherited fromBarItem

HasNeighbourToTheRight

Gets whether the item directly to the right of this item has an outline shape adjacent to this item.
protected bool HasNeighbourToTheRight()
inherited fromBarItem

IsEnabled

Gets whether both this element and the bar it belongs to are enabled.
public bool IsEnabled()
inherited fromBarItem

KeyDown

#
public override Response KeyDown(
KeyEventArgs
e
)
BarItem.KeyDown

KeyUp

public virtual Response KeyUp(
KeyEventArgs
e
)
inherited fromBarItem

Layout

#
protected override void Layout()
BarItem.Layout

MakeOptional

#
public void MakeOptional(
tooltipTitle,
tooltipMessage
)

MouseDoubleClick

#
public override Response MouseDoubleClick(
MouseEventArgs
e
)

MouseDown

#
public override Response MouseDown(
MouseEventArgs
e
)

MouseLeave

#
public override Response MouseLeave(
MouseEventArgs
e
)

MouseMove

#
public override Response MouseMove(
MouseEventArgs
e
)

MouseUp

#
public override Response MouseUp(
MouseEventArgs
e
)
BarItem.MouseUp

NeighbourToTheLeft

Gets whether this toolbar element has a neighbour directly to its left.
protected BarItem NeighbourToTheLeft(
skipSpacers = false
)
inherited fromBarItem

NeighbourToTheRight

Gets whether this toolbar element has a neighbour directly to its right.
protected BarItem NeighbourToTheRight(
skipSpacers = false
)
inherited fromBarItem

OverrideInfo

Override the info of the BarItem.Nomen field.
public void OverrideInfo(
newInfo
New info to assign.
)
inherited fromBarItem

OverrideText

Override the name of the BarItem.Nomen field.
public void OverrideText(
newName
New name to assign.
)
inherited fromBarItem

SetSizeLimits

Set the minimum and maximum width limits.
public void SetSizeLimits(
minimum,
maximum
)
inherited fromBarItem

SetSquiggle

#
Underline the text with a coloured squiggle and replace the tooltip with an explanation. This flags a problem with the *content* of the field rather than with the field itself, in the manner of a spellchecker.
public void SetSquiggle(
level,
Severity, which picks the colour of the squiggle.
caption,
Short description, shown as the tooltip title.
message
Long description, shown as the tooltip body.
)

SetText

#
Set new text content.
public void SetText(
text
)

ShowTooltipAt

#
public override bool ShowTooltipAt(
PointF
location
)

TextInput

#
public override Response TextInput(
TextInputEventArgs
e
)

Events

ActiveChanged

#
public event EventHandler<EventArgs> ActiveChanged

TextChanged

#
Raised whenever the text changes.
public event EventHandler<string> TextChanged