pub struct EditForm<'a, A, T = ()> {
pub form: Form,
/* private fields */
}Expand description
A Form and what setting each of its fields does, for the arguments
A and the session T.
Fields§
§form: FormImplementations§
Source§impl<'a, A, T> EditForm<'a, A, T>
impl<'a, A, T> EditForm<'a, A, T>
Sourcepub fn set(&self, key: &str, edit: Edit<'_, A, T>, value: Value)
pub fn set(&self, key: &str, edit: Edit<'_, A, T>, value: Value)
What the field key does with value: its setter’s. Nothing for a
key no field has — a field shown only to be read.
Sourcepub fn on(
&mut self,
key: impl Into<String>,
setter: impl Fn(Edit<'_, A, T>, Value) + 'a,
)
pub fn on( &mut self, key: impl Into<String>, setter: impl Fn(Edit<'_, A, T>, Value) + 'a, )
setter for the key key: for a control already in the dialog, or
one of its items — a list’s entries each have their own key.
Sourcepub fn input(
&mut self,
key: &str,
label: impl Into<String>,
value: impl Into<String>,
placeholder: Option<&str>,
set: impl Fn(Edit<'_, A, T>, &str) + 'a,
) -> &mut Self
pub fn input( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, placeholder: Option<&str>, set: impl Fn(Edit<'_, A, T>, &str) + 'a, ) -> &mut Self
Text typed — a name, a title — set to what is typed (see
crate::editing::Dialog::input).
Sourcepub fn table(
&mut self,
key: &str,
table: Table,
edit: impl Fn(Edit<'_, A, T>, TableEdit) + 'a,
) -> &mut Self
pub fn table( &mut self, key: &str, table: Table, edit: impl Fn(Edit<'_, A, T>, TableEdit) + 'a, ) -> &mut Self
A table edited in place (see Table): edit is run for each
thing done to it. A block pasted is taken apart here, into a row
added for each line below the last and the cells set, in reading
order — so edit never sees a TableEdit::Paste, and a cell set
in a row just added finds the row there.
Sourcepub fn actions(
&mut self,
key: &str,
actions: Vec<Action>,
run: impl Fn(Edit<'_, A, T>, &str) + 'a,
) -> &mut Self
pub fn actions( &mut self, key: &str, actions: Vec<Action>, run: impl Fn(Edit<'_, A, T>, &str) + 'a, ) -> &mut Self
Things to do or choose; pressing one runs run with its value.
pub fn checkbox( &mut self, key: &str, label: impl Into<String>, value: bool, set: impl Fn(Edit<'_, A, T>, bool) + 'a, ) -> &mut Self
pub fn number( &mut self, key: &str, number: Number, set: impl Fn(Edit<'_, A, T>, f64) + 'a, ) -> &mut Self
Sourcepub fn numeric(
&mut self,
key: &str,
number: Number,
set: impl Fn(Edit<'_, A, T>, NumericInput) + 'a,
) -> &mut Self
pub fn numeric( &mut self, key: &str, number: Number, set: impl Fn(Edit<'_, A, T>, NumericInput) + 'a, ) -> &mut Self
A number field of a NumericInput (see Number::numeric):
text typed sets it — plain if it is a number, a formula otherwise —
and a number slid or dragged sets it plain. A formula that does not
evaluate is kept, as typed, its field saying why: the step then fails
naming it, and the text is there to be corrected.
Sourcepub fn select(
&mut self,
key: &str,
label: impl Into<String>,
value: impl Into<String>,
options: Vec<Choice>,
searchable: bool,
set: impl Fn(Edit<'_, A, T>, &str) + 'a,
) -> &mut Self
pub fn select( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, options: Vec<Choice>, searchable: bool, set: impl Fn(Edit<'_, A, T>, &str) + 'a, ) -> &mut Self
One of options, by value — found by typing, if searchable.
Sourcepub fn file(
&mut self,
key: &str,
label: impl Into<String>,
value: impl Into<String>,
files: Vec<FileEntry>,
upload: &[&str],
set: impl Fn(Edit<'_, A, T>, &str) + 'a,
) -> &mut Self
pub fn file( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, files: Vec<FileEntry>, upload: &[&str], set: impl Fn(Edit<'_, A, T>, &str) + 'a, ) -> &mut Self
A file the program reads or places (see
crate::editing::Dialog::file).
Sourcepub fn color(
&mut self,
key: &str,
label: impl Into<String>,
value: impl Into<String>,
set: impl Fn(Edit<'_, A, T>, &str) + 'a,
) -> &mut Self
pub fn color( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, set: impl Fn(Edit<'_, A, T>, &str) + 'a, ) -> &mut Self
A colour, #rrggbb.
Sourcepub fn pick<P: Selectable>(
&mut self,
key: &str,
label: impl Into<String>,
reader: &Reader<'a>,
value: &[P],
multiple: bool,
set: impl Fn(Edit<'_, A, T>, Vec<P>) + 'a,
) -> &mut Self
pub fn pick<P: Selectable>( &mut self, key: &str, label: impl Into<String>, reader: &Reader<'a>, value: &[P], multiple: bool, set: impl Fn(Edit<'_, A, T>, Vec<P>) + 'a, ) -> &mut Self
Values picked, holding value, each selected by a click as P
says in the part reader reads (see Selectable): set gets what
the field holds after a pick — the values held, and the one a click
selected, or without the one it took out.
Sourcepub fn pick_one<P: Selectable>(
&mut self,
key: &str,
label: impl Into<String>,
reader: &Reader<'a>,
value: Option<&P>,
set: impl Fn(Edit<'_, A, T>, P) + 'a,
) -> &mut Self
pub fn pick_one<P: Selectable>( &mut self, key: &str, label: impl Into<String>, reader: &Reader<'a>, value: Option<&P>, set: impl Fn(Edit<'_, A, T>, P) + 'a, ) -> &mut Self
One value picked, holding value if there is one (see
EditForm::pick): set gets the value a click picks. Emptying
the field sets nothing: what a step needs one of is never none.