Class TextBox
A basic edit box
public class TextBox : Control
- Inheritance
-
TextBox
- Inherited Members
- Extension Methods
Constructors
TextBox(Dialog)
Creates a new edit box control
public TextBox(Dialog parent)
Parameters
parent
Dialog
Fields
LeftBorder
public const int LeftBorder = 4
Field Value
LowerBorder
public const int LowerBorder = 7
Field Value
LowerLeftBorder
public const int LowerLeftBorder = 6
Field Value
LowerRightBorder
public const int LowerRightBorder = 8
Field Value
RightBorder
public const int RightBorder = 5
Field Value
TextLayer
public const int TextLayer = 0
Field Value
TopBorder
public const int TopBorder = 2
Field Value
TopLeftBorder
public const int TopLeftBorder = 1
Field Value
TopRightBorder
public const int TopRightBorder = 3
Field Value
blinkTime
protected double blinkTime
Field Value
border
protected int border
Field Value
caretColor
protected Color4 caretColor
Field Value
- Color4
caretPosition
protected int caretPosition
Field Value
elementRects
protected Rectangle[] elementRects
Field Value
firstVisible
protected int firstVisible
Field Value
isCaretOn
protected bool isCaretOn
Field Value
isInsertMode
protected bool isInsertMode
Field Value
isMouseDragging
protected bool isMouseDragging
Field Value
lastBlink
protected double lastBlink
Field Value
selectedBackColor
protected Color4 selectedBackColor
Field Value
- Color4
selectedTextColor
protected Color4 selectedTextColor
Field Value
- Color4
spacing
protected int spacing
Field Value
textColor
protected Color4 textColor
Field Value
- Color4
textData
protected RichTextBox textData
Field Value
textRect
protected Rectangle textRect
Field Value
Properties
CanHaveFocus
Can the edit box have focus
public override bool CanHaveFocus { get; }
Property Value
Text
Get or sets the text
public string Text { get; set; }
Property Value
Methods
Clear()
Clears the edit box
public void Clear()
CopyToClipboard()
Copy the selected text to the clipboard
protected void CopyToClipboard()
DeleteSelectionText()
Deletes the text that is currently selected
protected void DeleteSelectionText()
GetTextCopy()
Gets a copy of the text
public string GetTextCopy()
Returns
HandleKeyboard(WindowMessage, IntPtr, IntPtr)
Handle keyboard input to the edit box
public override bool HandleKeyboard(WindowMessage msg, IntPtr wParam, IntPtr lParam)
Parameters
msg
WindowMessagewParam
IntPtrlParam
IntPtr
Returns
HandleMouse(WindowMessage, Point, IntPtr, IntPtr)
Handle mouse messages
public override bool HandleMouse(WindowMessage msg, Point pt, IntPtr wParam, IntPtr lParam)
Parameters
msg
WindowMessagept
PointwParam
IntPtrlParam
IntPtr
Returns
MsgProc(IntPtr, WindowMessage, IntPtr, IntPtr)
Handle all other messages
public override bool MsgProc(IntPtr hWnd, WindowMessage msg, IntPtr wParam, IntPtr lParam)
Parameters
hWnd
IntPtrmsg
WindowMessagewParam
IntPtrlParam
IntPtr
Returns
OnFocusIn()
Update the caret when focus is in
public override void OnFocusIn()
PasteFromClipboard()
Paste the clipboard data to the control
protected void PasteFromClipboard()
PlaceCaret(int)
Set the caret to a character position, and adjust the scrolling if necessary
protected void PlaceCaret(int pos)
Parameters
pos
int
RaiseChangedEvent(TextBox, bool)
Raises the changed event
protected void RaiseChangedEvent(TextBox sender, bool wasTriggeredByUser)
Parameters
RaiseEnterEvent(TextBox, bool)
Raises the Enter event
protected void RaiseEnterEvent(TextBox sender, bool wasTriggeredByUser)
Parameters
Render(Device, float)
Render the control
public override void Render(Device device, float elapsedTime)
Parameters
device
DeviceelapsedTime
float
ResetCaretBlink()
Reset's the caret blink time
protected void ResetCaretBlink()
SetBorderWidth(int)
Update the border
public void SetBorderWidth(int b)
Parameters
b
int
SetCaretColor(Color4)
Update the caret color
public void SetCaretColor(Color4 color)
Parameters
color
Color4
SetSelectedBackColor(Color4)
Update the selected background color
public void SetSelectedBackColor(Color4 color)
Parameters
color
Color4
SetSelectedTextColor(Color4)
Update the text selected color
public void SetSelectedTextColor(Color4 color)
Parameters
color
Color4
SetSpacing(int)
Update the spacing
public void SetSpacing(int space)
Parameters
space
int
SetText(string?, bool)
Sets the text for the control
public void SetText(string? text, bool selected)
Parameters
SetTextColor(Color4)
Update the text color
public void SetTextColor(Color4 color)
Parameters
color
Color4
UpdateRectangles()
Updates the rectangles used by the control
protected override void UpdateRectangles()
Events
Changed
public event EventHandler Changed
Event Type
Enter
public event EventHandler Enter