A single line text box. Click it to give it keyboard focus, then type. The characters go into the box instead of to the command line for as long as it has focus; Enter commits what was typed, Escape puts back the text the box started with, and both give the focus back to the viewport.

Constructors

UserInterfaceTextBox

#Since v9.0
public UserInterfaceTextBox()

UserInterfaceTextBox

#Since v9.0
public UserInterfaceTextBox(
text
)

Properties

BackgroundColor

Color the control is filled with: the face of a button, the track of a slider, the box of a check box or radio button, the field of a text box, the whole rectangle of a label, icon or grid. Color.Empty, the default, means the control chooses the color for the theme that is in use and follows the theme when it changes. Labels and icons draw no background when this is Color.Empty. A grid fills with the theme's panel color when it is a top level control, and draws no background when it is inside another control. UserInterfaceGrid.BackgroundOpacity makes the theme color see through, or turns the background off at 0.
public Color BackgroundColor { get; set; }
inherited fromUserInterfaceControl

BorderColor

#Since v9.0
Color of the outline around the box. Color.Empty, the default, means use the standard color for the theme that is in use. The outline is drawn thicker and brighter while the box has keyboard focus, whatever color it is given.
public Color BorderColor { get; set; }

BoundToActiveView

public bool BoundToActiveView { get; set; }
inherited fromUserInterfaceObjectBase

CaretPosition

#Since v9.0
Where the insertion point sits, as a count of characters from the start of the text. Setting it clamps to the length of the text.
public int CaretPosition { get; set; }

HasKeyboardFocus

Does this object have keyboard focus? An object with keyboard focus gets first refusal on what is typed in a viewport; what it does not use carries on to the command line as usual.
public bool HasKeyboardFocus { get; }
inherited fromUserInterfaceObjectBase

HorizontalAlignment

public ControlHorizontalAlignment HorizontalAlignment { get; set; }
inherited fromUserInterfaceControl

Location

public PointF Location { get; set; }
inherited fromUserInterfaceControl

MaximumLength

#Since v9.0
Most characters the text will hold. 0, the default, means no limit.
public int MaximumLength { get; set; }

PlaceholderText

#Since v9.0
Text drawn, dimmed, when the box is empty and does not have focus
public string PlaceholderText { get; set; }

ReadOnly

#Since v9.0
A read only text box can take focus and be scrolled through, but typing does not change it. False by default.
public bool ReadOnly { get; set; }

Size

public SizeF Size { get; set; }
inherited fromUserInterfaceControl

Text

#Since v9.0
What the box holds. Unlike the other controls, this is something the user changes, so reading it asks the box itself what is in it.
public override string Text { get; set; }

TextColor

Color used to draw the text. Color.Empty, the default, means use the standard text color for the theme that is in use.
public Color TextColor { get; set; }
inherited fromUserInterfaceControl

TextHeight

Height of the text in logical pixels. A value of 0, the default, means use the standard control font height. Controls that draw no text ignore this setting.
public float TextHeight { get; set; }
inherited fromUserInterfaceControl

TextHorizontalAlignment

Where the text sits inside the control's rectangle. This is not the same as HorizontalAlignment, which is where the control sits inside its parent.
public ControlHorizontalAlignment TextHorizontalAlignment { get; set; }
inherited fromUserInterfaceControl

TextVerticalAlignment

Where the text sits inside the control's rectangle. This is not the same as VerticalAlignment, which is where the control sits inside its parent.
public ControlVerticalAlignment TextVerticalAlignment { get; set; }
inherited fromUserInterfaceControl

Tooltip

Text shown in a tooltip when the mouse rests over this object. Null or an empty string means no tooltip, which is what an object starts with. One tooltip is on screen at a time; whichever object the mouse is over owns it.
public string Tooltip { get; set; }
inherited fromUserInterfaceObjectBase

TrackingPoint

3d location that control "sticks" to if not null
public Point3d? TrackingPoint { get; set; }
inherited fromUserInterfaceControl

VerticalAlignment

public ControlVerticalAlignment VerticalAlignment { get; set; }
inherited fromUserInterfaceControl

Visible

Is the user interface object visible? Objects that are not visible will not be drawn and will not receive mouse events
public bool Visible { get; set; }
inherited fromUserInterfaceObjectBase

Methods

ComputedRectangle

public RectangleF ComputedRectangle(
view,
logicalPixels
)
inherited fromUserInterfaceControl

IsMouseOver

Called to test if the mouse is actively over this object
protected virtual bool IsMouseOver()
inherited fromUserInterfaceObjectBase
Return true if the mouse is over this object

IsRegistered

Is this user interface object active
public bool IsRegistered()
inherited fromUserInterfaceObjectBase

OnDraw

All user interface objects are drawn and can customize their look with the OnDraw function
protected virtual void OnDraw()
inherited fromUserInterfaceObjectBase

OnEditCanceled

#
Called when Escape is pressed. The text has already been put back to what it was when the box took focus. The default implementation raises the EditCanceled event.
protected virtual void OnEditCanceled()

OnKeyboardFocusChanged

#
Called when the box gains or loses keyboard focus. Read HasKeyboardFocus to find out which. The default implementation raises the KeyboardFocusChanged event.
protected virtual void OnKeyboardFocusChanged(
hasFocus
True when the box has just taken focus
)

OnMouseClick

Called during a mouse click event on this object
protected virtual void OnMouseClick()
inherited fromUserInterfaceObjectBase

OnMouseDoubleClick

Called during a mouse double click event on this object
protected virtual void OnMouseDoubleClick()
inherited fromUserInterfaceObjectBase

OnMouseDown

Called when the mouse goes down on this object
protected virtual void OnMouseDown(
mouse
Current mouse state when this event occurs
)
inherited fromUserInterfaceObjectBase

OnMouseEnter

Called when the mouse goes over this object
protected virtual void OnMouseEnter()
inherited fromUserInterfaceObjectBase

OnMouseLeave

Called when the mouse leaves this object
protected virtual void OnMouseLeave()
inherited fromUserInterfaceObjectBase

OnMouseMove

Called when the mouse is moved
protected virtual void OnMouseMove()
inherited fromUserInterfaceObjectBase

OnMouseUp

Called when the mouse is released on this object
protected virtual void OnMouseUp()
inherited fromUserInterfaceObjectBase

OnRunCommand

Called after the above RunCommand function is called. This will be executing while inside of a Rhino command.
protected virtual Result OnRunCommand(
doc,
Document that the command is running in
mode,
Interactive or scripted mode
mouse
Mouse state that was passed to RunCommand
)
inherited fromUserInterfaceObjectBase
Result of the command. The default implementation returns Success

OnTextChanged

#
Called every time the text changes, once per keystroke. The default implementation raises the TextChanged event.
protected virtual void OnTextChanged()

OnTextCommitted

#
Called when Enter is pressed, and when the box loses focus with the text changed from what it started with. This is where you do something about the new text. The default implementation raises the TextCommitted event.
protected virtual void OnTextCommitted()

RegisterForAllDocuments

Make this object visible for all documents. Typically you will only have user interface objects work with single documents. For that case, call doc.ViewUserInterface.Add
public bool RegisterForAllDocuments()
inherited fromUserInterfaceObjectBase

RunCommand

Call RunCommand to have the virtual OnRunCommand function executed in the scope of a Rhino command. If you are modifying the document from one of the mouse functions on this object, this is the best approach to do so since changes made inside of a command are recorded for undo.
public void RunCommand(
mouse
Current mouse state. This is handed back to OnRunCommand
)
inherited fromUserInterfaceObjectBase

SetSvg

public void SetSvg(
svg
)
inherited fromUserInterfaceControl

TakeKeyboardFocus

#Since v9.0
Give this text box keyboard focus, as clicking it does
public void TakeKeyboardFocus(
doc
Document to redraw. This can be null.
)

Unregister

Unregister this object
public void Unregister()
inherited fromUserInterfaceObjectBase

Events

EditCanceled

#Since v9.0
Event triggered when Escape puts back the text the box started with
public event EventHandler EditCanceled

KeyboardFocusChanged

#Since v9.0
Event triggered when the box gains or loses keyboard focus
public event EventHandler KeyboardFocusChanged

TextChanged

#Since v9.0
Event triggered every time the text changes, once per keystroke
public event EventHandler TextChanged

TextCommitted

#Since v9.0
Event triggered when what was typed is committed, by Enter or by the box losing focus with the text changed
public event EventHandler TextCommitted