Skip to content

StringInputDialog

JaykeBird edited this page Feb 21, 2023 · 9 revisions

Back to home | Back to Reference | View raw text

StringInputDialog class

Diagram

  flowchart LR
  classDef interfaceStyle stroke-dasharray: 5 5;
  classDef abstractStyle stroke-width:4px
  subgraph SolidShineUi
  SolidShineUi.StringInputDialog[[StringInputDialog]]
  SolidShineUi.FlatWindow[[FlatWindow]]
  end
  subgraph System.Windows.Markup
System.Windows.Markup.IComponentConnector[[IComponentConnector]]
  end
System.Windows.Markup.IComponentConnector --> SolidShineUi.StringInputDialog
SolidShineUi.FlatWindow --> SolidShineUi.StringInputDialog
Loading

Members

Properties

Public properties

Type Name Methods
string Description
Get or set the description text to display above the text box. This text should describe what the user should enter into the text box.
get, set
bool DialogResult
Get the result of the dialog when it is closed. "False" refers to the user cancelling the operation, while "True" refers to the user confirming, by clicking "OK" or pressing the Enter key.
get
bool EnterKeyConfirms
Get or set whether the Enter key can be used to confirm the dialog. If enabled, pressing down the Enter key will be treated as if the user pressed "OK".
get, set
bool EscapeKeyCancels
Get or set whether the Escape key can be used to cancel the dialog. If enabled, pressing down the Escape key will be treated as if the user pressed "Cancel".
get, set
bool SelectTextOnFocus
Get or set whether all of the text in the text box should be selected when the text box receives focus.
get, set
string ValidationFailureString
Get or set the string to display in the UI when the validation returns false (a failure), indicating an invalid or unusable string.
get, set
Func<string, bool> ValidationFunction
Get or set the data validation function that should be used to make sure the inputted string matches an expected format.
get, set
string ValidationSuccessString
Get or set the string to display in the UI when the validation returns true (a success), indicating a good and valid string.
get, set
string Value
Get or set the text value of the input dialog's text box.
get, set

Methods

Public methods

Returns Name
void InitializeComponent()
InitializeComponent

Internal methods

Returns Name
Delegate _CreateDelegate(Type delegateType, string handler)

Details

Inheritance

Constructors

StringInputDialog [1/3]

public StringInputDialog()
Summary

Create a StringInputDialog with nothing preset.

StringInputDialog [2/3]

public StringInputDialog(ColorScheme cs)
Arguments
Type Name Description
ColorScheme cs The color scheme to use for the window.
Summary

Create a StringInputDialog with a color scheme.

StringInputDialog [3/3]

public StringInputDialog(ColorScheme cs, string title, string desc, string value)
Arguments
Type Name Description
ColorScheme cs The color scheme to use for the window.
string title The title of the window.
string desc The description to give to the user.
string value The value to place in the text box. By default, the text box is empty.
Summary

Create a StringInputBox with prefilled values.

Methods

InitializeComponent

public virtual void InitializeComponent()
Summary

InitializeComponent

_CreateDelegate

internal Delegate _CreateDelegate(Type delegateType, string handler)
Arguments
Type Name Description
Type delegateType
string handler

Properties

Value

public string Value { get; set; }
Summary

Get or set the text value of the input dialog's text box.

Description

public string Description { get; set; }
Summary

Get or set the description text to display above the text box. This text should describe what the user should enter into the text box.

Remarks

Try to keep the description to about a sentence long. If you do have a lengthier description, you may need to resize the window to make it fit properly. Ideally, the overall design of the program should make it apparent what the user should enter into the text box without reading the description. However, the description is helpful to remind the user what is being asked of them here, and also to potentially clarify the types of values that are valid or invalid.

DialogResult

public bool DialogResult { get; }
Summary

Get the result of the dialog when it is closed. "False" refers to the user cancelling the operation, while "True" refers to the user confirming, by clicking "OK" or pressing the Enter key.

EnterKeyConfirms

public bool EnterKeyConfirms { get; set; }
Summary

Get or set whether the Enter key can be used to confirm the dialog. If enabled, pressing down the Enter key will be treated as if the user pressed "OK".

EscapeKeyCancels

public bool EscapeKeyCancels { get; set; }
Summary

Get or set whether the Escape key can be used to cancel the dialog. If enabled, pressing down the Escape key will be treated as if the user pressed "Cancel".

SelectTextOnFocus

public bool SelectTextOnFocus { get; set; }
Summary

Get or set whether all of the text in the text box should be selected when the text box receives focus.

ValidationFunction

public Func<string, bool> ValidationFunction { get; set; }
Summary

Get or set the data validation function that should be used to make sure the inputted string matches an expected format.

Remarks

Set this to null if you want to disable data validation. This function is called every time that the text in the text box is changed, so it's important to have a function that is relatively fast, so as to avoid blocking the UI thread. The function will be given the current text in the text box, and is asked to return a bool if it matches the expected validation ( true for a good match, false for an invalid string).

ValidationSuccessString

public string ValidationSuccessString { get; set; }
Summary

Get or set the string to display in the UI when the validation returns true (a success), indicating a good and valid string.

ValidationFailureString

public string ValidationFailureString { get; set; }
Summary

Get or set the string to display in the UI when the validation returns false (a failure), indicating an invalid or unusable string.

Generated with ModularDoc

Clone this wiki locally