Function zng_wgt_button::cmd
source · pub fn cmd(cmd: impl IntoVar<Command>)
Expand description
c
Sets the Command
the button represents.
When this is set the button widget sets these properties if they are not set:
child
: Set to a widget produced bycmd_child_fn
, by default isText!(cmd.name())
.tooltip_fn
: Set to a widget function provided bycmd_tooltip_fn
, by default it shows the command info and first shortcut.enabled
: Set tocmd.is_enabled()
.visibility
: Set tocmd.has_handlers().into()
.on_click
: Set to a handler that notifies the command ifcmd.is_enabled()
.on_disabled_click
: Set to a handler that notifies the command if!cmd.is_enabled()
.
§Capture-Only
This property is capture-only, it only defines a property signature, it does not implement any behavior by itself. Widgets can capture and implement this property as part of their intrinsics, otherwise it will have no effect if set on a widget that does not implement it.