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 by cmd_child_fn, by default is Text!(cmd.name()).
  • tooltip_fn: Set to a widget function provided by cmd_tooltip_fn, by default it shows the command info and first shortcut.
  • enabled: Set to cmd.is_enabled().
  • visibility: Set to cmd.has_handlers().into().
  • on_click: Set to a handler that notifies the command if cmd.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.