# UserInterfaceTextBox class

Namespace: [Rhino.UI](https://developer.rhino3d.com/api/rhinocommon/namespace/rhino.ui.md) · Assembly: [RhinoCommon](https://developer.rhino3d.com/api/rhinocommon/assembly/rhinocommon.md)

```cs
public class UserInterfaceTextBox : UserInterfaceControl
```

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](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/ctor.md): (2 overloads)

## Properties

- [BorderColor](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/bordercolor.md): 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.
- [CaretPosition](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/caretposition.md): 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.
- [MaximumLength](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/maximumlength.md): Most characters the text will hold. 0, the default, means no limit.
- [PlaceholderText](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/placeholdertext.md): Text drawn, dimmed, when the box is empty and does not have focus
- [ReadOnly](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/readonly.md): A read only text box can take focus and be scrolled through, but typing does not change it. False by default.
- [Text](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/text.md): 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.

## Methods

- [OnEditCanceled](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/oneditcanceled.md): 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.
- [OnKeyboardFocusChanged](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/onkeyboardfocuschanged.md): Called when the box gains or loses keyboard focus. Read HasKeyboardFocus to find out which. The default implementation raises the KeyboardFocusChanged event.
- [OnTextChanged](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/ontextchanged.md): Called every time the text changes, once per keystroke. The default implementation raises the TextChanged event.
- [OnTextCommitted](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/ontextcommitted.md): 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.
- [TakeKeyboardFocus](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/takekeyboardfocus.md): Give this text box keyboard focus, as clicking it does

## Events

- [EditCanceled](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/editcanceled.md): Event triggered when Escape puts back the text the box started with
- [KeyboardFocusChanged](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/keyboardfocuschanged.md): Event triggered when the box gains or loses keyboard focus
- [TextChanged](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/textchanged.md): Event triggered every time the text changes, once per keystroke
- [TextCommitted](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacetextbox/textcommitted.md): Event triggered when what was typed is committed, by Enter or by the box losing focus with the text changed

## Inherited Members

- From [UserInterfaceControl](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol.md): [BackgroundColor](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol/backgroundcolor.md), [HorizontalAlignment](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol/horizontalalignment.md), [Location](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol/location.md), [Size](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol/size.md), [TextColor](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol/textcolor.md), [TextHeight](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol/textheight.md), [TextHorizontalAlignment](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol/texthorizontalalignment.md), [TextVerticalAlignment](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol/textverticalalignment.md), [TrackingPoint](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol/trackingpoint.md), [VerticalAlignment](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol/verticalalignment.md), [ComputedRectangle](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol/computedrectangle.md), [SetSvg](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfacecontrol/setsvg.md)
- From [UserInterfaceObjectBase](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase.md): [BoundToActiveView](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/boundtoactiveview.md), [HasKeyboardFocus](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/haskeyboardfocus.md), [Tooltip](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/tooltip.md), [Visible](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/visible.md), [IsMouseOver](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/ismouseover.md), [IsRegistered](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/isregistered.md), [OnDraw](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/ondraw.md), [OnMouseClick](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/onmouseclick.md), [OnMouseDoubleClick](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/onmousedoubleclick.md), [OnMouseDown](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/onmousedown.md), [OnMouseEnter](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/onmouseenter.md), [OnMouseLeave](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/onmouseleave.md), [OnMouseMove](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/onmousemove.md), [OnMouseUp](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/onmouseup.md), [OnRunCommand](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/onruncommand.md), [RegisterForAllDocuments](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/registerforalldocuments.md), [RunCommand](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/runcommand.md), [Unregister](https://developer.rhino3d.com/api/rhinocommon/type/rhino.ui.userinterfaceobjectbase/unregister.md)
