morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::TextInput Struct Reference

An editable text field. The backend never reports its own setText back through onChange. More...

#include <view.hpp>

Public Attributes

Prop< std::string > value
 The text the field shows.
std::function< void(std::string)> onChange
 Called with the new text after every user edit.
std::function< void(std::string)> onSubmit
 Called with the text when the user submits (Enter in single-line mode).
std::function< void(std::string)> onCommit
 Called with the text when the user commits it: Enter in single-line mode, or focus leaving the field after an edit.
Prop< std::string > placeholder
 Shown while the field is empty.
TextInputMode mode = TextInputMode::SingleLine
 Single-line, multiline or password; set once.
Prop< std::string > unit
 The unit the input shows beside its text, such as kg; empty shows none. Only a single-line or password input shows one: the mount refuses a multiline input with a unit.
std::string icon
 The name of an icon in the theme's icon set, drawn at the field's leading edge; empty shows none. Only a single-line or password input shows one: the mount refuses a multiline input with an icon. Set once.
int decimals = -1
 The fraction digits a number is entered with, for a backend or a kit to read; -1 when the input does not hold a number. Set once; the mount refuses places on a multiline input.
Prop< std::string > label
 The field's label: its visible caption while showLabel; a form's cell draws it otherwise, beside the input. Empty: none.
bool showLabel = false
 Whether the input draws label as a visible caption itself; set once. A form leaves it false, since its cell draws the caption.
FieldState field {}
 Read-only, required, errors and stale.
Common common {}
 Visibility, enablement, layout, drag-and-drop.

Detailed Description

An editable text field. The backend never reports its own setText back through onChange.

Definition at line 437 of file view.hpp.

Member Data Documentation

◆ value

Prop<std::string> morph::ui::TextInput::value

The text the field shows.

Definition at line 439 of file view.hpp.

◆ onChange

std::function<void(std::string)> morph::ui::TextInput::onChange

Called with the new text after every user edit.

Definition at line 441 of file view.hpp.

◆ onSubmit

std::function<void(std::string)> morph::ui::TextInput::onSubmit

Called with the text when the user submits (Enter in single-line mode).

Definition at line 443 of file view.hpp.

◆ onCommit

std::function<void(std::string)> morph::ui::TextInput::onCommit

Called with the text when the user commits it: Enter in single-line mode, or focus leaving the field after an edit.

Definition at line 446 of file view.hpp.

◆ placeholder

Prop<std::string> morph::ui::TextInput::placeholder

Shown while the field is empty.

Definition at line 448 of file view.hpp.

◆ mode

TextInputMode morph::ui::TextInput::mode = TextInputMode::SingleLine

Single-line, multiline or password; set once.

Definition at line 450 of file view.hpp.

◆ unit

Prop<std::string> morph::ui::TextInput::unit

The unit the input shows beside its text, such as kg; empty shows none. Only a single-line or password input shows one: the mount refuses a multiline input with a unit.

Definition at line 453 of file view.hpp.

◆ icon

std::string morph::ui::TextInput::icon

The name of an icon in the theme's icon set, drawn at the field's leading edge; empty shows none. Only a single-line or password input shows one: the mount refuses a multiline input with an icon. Set once.

Definition at line 456 of file view.hpp.

◆ decimals

int morph::ui::TextInput::decimals = -1

The fraction digits a number is entered with, for a backend or a kit to read; -1 when the input does not hold a number. Set once; the mount refuses places on a multiline input.

Definition at line 459 of file view.hpp.

◆ label

Prop<std::string> morph::ui::TextInput::label

The field's label: its visible caption while showLabel; a form's cell draws it otherwise, beside the input. Empty: none.

Definition at line 462 of file view.hpp.

◆ showLabel

bool morph::ui::TextInput::showLabel = false

Whether the input draws label as a visible caption itself; set once. A form leaves it false, since its cell draws the caption.

Definition at line 465 of file view.hpp.

◆ field

FieldState morph::ui::TextInput::field {}

Read-only, required, errors and stale.

Definition at line 467 of file view.hpp.

◆ common

Common morph::ui::TextInput::common {}

Visibility, enablement, layout, drag-and-drop.

Definition at line 469 of file view.hpp.


The documentation for this struct was generated from the following file: