EditBoxes are used to allow the player to type text into a UI component. They inherit from FontInstance as well as Frame in order to provide the needed support for text display, and add methods for entering text, such as positioning a cursor within text, establishing character limits, controlling whether text should be displayed in password-fashion (with bullets substituted for the characters), manipulating an entry history, or controlling and responding to changes in keyboard focus.
The most common use for an EditBox is to accept chat input from the player, but they are also used for commands, configuration, and confirmation, such as requiring you to type "DELETE" before destroying a valuable item, or entering the name of a new macro.
Most EditBoxes are derived from ChatFrameEditBoxTemplate, or use the same textures to create a visible frame around the editable area.
Defined Methods
- EditBox:ClearHistory() - This function is not yet documented
- EditBox:Disable() - This function is not yet documented
- EditBox:Enable() - This function is not yet documented
- EditBox:IsCountInvisibleLetters() - This function is not yet documented
- EditBox:IsEnabled() - This function is not yet documented
- EditBox:SetCountInvisibleLetters() - This function is not yet documented
- EditBox:SetEnabled() - This function is not yet documented
- EditBox:SetFocus() - Focuses the edit box for keyboard input
- EditBox:SetHistoryLines(count) - Sets the maximum number of history lines stored by the edit box
- EditBox:SetHyperlinksEnabled(enable) - Set whether OnHyperlink* scripts will run for the editbox
- EditBox:SetIndentedWordWrap(indent) - Sets whether long lines of text are indented when wrapping
- EditBox:SetMaxBytes(maxBytes) - Sets the maximum number of bytes of text allowed in the edit box
- EditBox:SetMaxLetters(maxLetters) - Sets the maximum number of text characters allowed in the edit box
- EditBox:SetMultiLine(multiLine) - Sets whether the edit box shows more than one line of text
- EditBox:SetNumber(num) - Sets the contents of the edit box to a number
- EditBox:SetNumeric(enable) - Sets whether the edit box only accepts numeric input
- EditBox:SetPassword(enable) - Sets whether the text entered in the edit box is masked
- EditBox:SetText("text") - Sets the edit box's text contents
- EditBox:SetTextInsets(left, right, top, bottom) - Sets the insets from the edit box's edges which determine its interactive text area
- EditBox:ToggleInputLanguage() - Switches the edit box's language input mode
Inherited Methods
- EditBox:GetPropagateKeyboardInput() - This function is not yet documented
- EditBox:IsForbidden() - This function is not yet documented
- EditBox:RegisterUnitEvent() - This function is not yet documented
- EditBox:SetDontSavePosition() - This function is not yet documented
- EditBox:SetPropagateKeyboardInput() - This function is not yet documented
- EditBox:SetShown() - This function is not yet documented
- EditBox:SetSize(width, height) - Sets the size of the region to the specified values
- EditBox:SetSpacing(spacing) - Sets the font instance's amount of spacing between lines
- EditBox:SetTextColor(textR, textG, textB, textAlpha) - Sets the font instance's default text color
- EditBox:SetToplevel(enable) - Sets whether the frame should automatically come to the front when clicked
- EditBox:SetUserPlaced(enable) - Flags the frame for automatic saving and restoration of position and dimensions
- EditBox:SetWidth(width) - Sets the region's width
- EditBox:Show() - Shows the region
- EditBox:StartMoving() - Begins repositioning the frame via mouse movement
- EditBox:StartSizing() - Begins resizing the frame via mouse movement
- EditBox:StopAnimating() - Stops any active animations involving the region or its children
- EditBox:StopMovingOrSizing() - Ends movement or resizing of the frame initiated with [[docs/widgets/Frame/StartMoving|`:StartMoving()`]] or [[docs/widgets/Frame/StartSizing|`:StartSizing()`]]
- EditBox:UnregisterAllEvents() - Unregisters the frame from any [[docs/events|events]] for which it is registered
- EditBox:UnregisterEvent("event") - Unregisters the frame for an event
Script Handlers
- OnAttributeChanged(self, "name", value) - Run when a frame attribute is changed
- OnChar(self, "text") - Run for each text character typed in the frame
- OnCharComposition(self, "text") - Run when the edit box's input composition mode changes
- OnCursorChanged(self, x, y, width, height) - Run when the position of the text insertion cursor in the edit box changes
- OnDisable(self) - Run when the frame is disabled
- OnDragStart(self, "button") - Run when the mouse is dragged starting in the frame
- OnDragStop(self) - Run when the mouse button is released after a drag started in the frame
- OnEditFocusGained(self) - Run when the edit box becomes focused for keyboard input
- OnEditFocusLost(self) - Run when the edit box loses keyboard input focus
- OnEnable(self) - Run when the frame is enabled
- OnEnter(self, motion) - Run when the mouse cursor enters the frame's interactive area
- OnEnterPressed(self) - Run when the Enter (or Return) key is pressed while the edit box has keyboard focus
- OnEscapePressed(self) - Run when the Escape key is pressed while the edit box has keyboard focus
- OnEvent(self, "event", ...) - Run whenever an [[docs/events|event]] fires for which the frame is registered
- OnHide(self) - Run when the frame's visbility changes to hidden
- OnHyperlinkClick(self, "linkData", "link", "button") - Run when the mouse clicks a hyperlink in the scrolling message frame or SimpleHTML frame
- OnHyperlinkEnter(self, "linkData", "link") - Run when the mouse moves over a hyperlink in the scrolling message frame or SimpleHTML frame
- OnHyperlinkLeave(self, "linkData", "link") - Run when the mouse moves away from a hyperlink in the scrolling message frame or SimpleHTML frame
- OnInputLanguageChanged(self, "language") - Run when the edit box's language input mode changes
- OnKeyDown(self, "key") - Run when a keyboard key is pressed if the frame is keyboard enabled
- OnKeyUp(self, "key") - Run when a keyboard key is released if the frame is keyboard enabled
- OnLeave(self, motion) - Run when the mouse cursor leaves the frame's interactive area
- OnLoad(self) - Run when the frame is created
- OnMouseDown(self, "button") - Run when a mouse button is pressed while the cursor is over the frame
- OnMouseUp(self, "button") - Run when the mouse button is released following a mouse down action in the frame
- OnMouseWheel(self, delta) - Run when the frame receives a mouse wheel scrolling action
- OnReceiveDrag(self) - Run when the mouse button is released after dragging into the frame
- OnShow(self) - Run when the frame becomes visible
- OnSizeChanged(self, width, height) - Run when a frame's size changes
- OnSpacePressed(self) - Run when the space bar is pressed while the edit box has keyboard focus
- OnTabPressed(self) - Run when the Tab key is pressed while the edit box has keyboard focus
- OnTextChanged(self, userInput) - Run when the edit box's text is changed
- OnTextSet(self) - Run when the edit box's text is set programmatically
- OnUpdate(self, elapsed) - Run each time the screen is drawn by the game engine