Class PromptBuilder
- Namespace
- SharpConsoleUI.Builders
- Assembly
- SharpConsoleUI.dll
Fluent builder for prompt controls
public sealed class PromptBuilder
- Inheritance
-
PromptBuilder
- Inherited Members
Methods
Build()
Builds the prompt control
public PromptControl Build()
Returns
OnEntered(WindowEventHandler<string>)
Sets the entered event handler with window access
public PromptBuilder OnEntered(WindowEventHandler<string> handler)
Parameters
handlerWindowEventHandler<string>
Returns
OnEntered(EventHandler<string>)
Sets the entered event handler (fired when Enter is pressed)
public PromptBuilder OnEntered(EventHandler<string> handler)
Parameters
handlerEventHandler<string>
Returns
OnGotFocus(WindowEventHandler<EventArgs>)
Sets the GotFocus event handler with window access
public PromptBuilder OnGotFocus(WindowEventHandler<EventArgs> handler)
Parameters
handlerWindowEventHandler<EventArgs>Handler that receives sender, event data, and window
Returns
- PromptBuilder
The builder for chaining
OnGotFocus(EventHandler)
Sets the GotFocus event handler
public PromptBuilder OnGotFocus(EventHandler handler)
Parameters
handlerEventHandlerThe event handler to invoke when the prompt receives focus
Returns
- PromptBuilder
The builder for chaining
OnInputChanged(WindowEventHandler<string>)
Sets the input changed event handler with window access
public PromptBuilder OnInputChanged(WindowEventHandler<string> handler)
Parameters
handlerWindowEventHandler<string>
Returns
OnInputChanged(EventHandler<string>)
Sets the input changed event handler (fired when text changes)
public PromptBuilder OnInputChanged(EventHandler<string> handler)
Parameters
handlerEventHandler<string>
Returns
OnLostFocus(WindowEventHandler<EventArgs>)
Sets the LostFocus event handler with window access
public PromptBuilder OnLostFocus(WindowEventHandler<EventArgs> handler)
Parameters
handlerWindowEventHandler<EventArgs>Handler that receives sender, event data, and window
Returns
- PromptBuilder
The builder for chaining
OnLostFocus(EventHandler)
Sets the LostFocus event handler
public PromptBuilder OnLostFocus(EventHandler handler)
Parameters
handlerEventHandlerThe event handler to invoke when the prompt loses focus
Returns
- PromptBuilder
The builder for chaining
StickyBottom()
Makes the control stick to the bottom of the window
public PromptBuilder StickyBottom()
Returns
StickyTop()
Makes the control stick to the top of the window
public PromptBuilder StickyTop()
Returns
UnfocusOnEnter(bool)
Sets whether the control loses focus when Enter is pressed
public PromptBuilder UnfocusOnEnter(bool unfocus = true)
Parameters
unfocusbool
Returns
Visible(bool)
Sets the visibility
public PromptBuilder Visible(bool visible = true)
Parameters
visiblebool
Returns
WithAlignment(HorizontalAlignment)
Sets the horizontal alignment
public PromptBuilder WithAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignment
Returns
WithInput(string)
Sets the initial input value
public PromptBuilder WithInput(string input)
Parameters
inputstring
Returns
WithMargin(int)
Sets uniform margin
public PromptBuilder WithMargin(int margin)
Parameters
marginint
Returns
WithMargin(int, int, int, int)
Sets the margin
public PromptBuilder WithMargin(int left, int top, int right, int bottom)
Parameters
Returns
WithName(string)
Sets the control name for lookup
public PromptBuilder WithName(string name)
Parameters
namestring
Returns
WithPrompt(string)
Sets the prompt text (displayed before the input area)
public PromptBuilder WithPrompt(string prompt)
Parameters
promptstring
Returns
WithStickyPosition(StickyPosition)
Sets the sticky position
public PromptBuilder WithStickyPosition(StickyPosition position)
Parameters
positionStickyPosition
Returns
WithTag(object)
Sets a tag object
public PromptBuilder WithTag(object tag)
Parameters
tagobject
Returns
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment
public PromptBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignment
Returns
WithWidth(int)
Sets the width
public PromptBuilder WithWidth(int width)
Parameters
widthint
Returns
Operators
implicit operator PromptControl(PromptBuilder)
Implicit conversion to PromptControl
public static implicit operator PromptControl(PromptBuilder builder)
Parameters
builderPromptBuilder