Macro selector

Source
selector!() { /* proc-macro */ }
Expand description

Creates a new selector control for choosing enum values. The format is selector!("attributes") where the attributes are pairs of key-value, separated by comma.

§Parameters

  • enum or class (required, first positional parameter) - The enum type to use for selection
  • value - Initial selected enum variant (optional)
  • flags - Control flags (optional). Can be:
    • AllowNoneVariant - Allows selecting no value (None)
  • Position and size:
    • x, y - Position coordinates
    • width/w, height/h - Control dimensions
  • Layout:
    • align/a - Alignment: Left, Right, Top, Bottom, Center, etc.
    • dock/d - Docking: Left, Right, Top, Bottom, Center, etc.
  • Margins: left/l, right/r, top/t, bottom/b
  • State: enabled, visible

§Examples

use appcui::prelude::*;
 
// Basic selector
let sel = selector!("MyEnum, x=1, y=1, width=20");
 
// Selector with initial value
let sel = selector!(
    "enum: MyEnum,
    value: Variant1,
    x=2, y=2, width=25"
);
 
// Selector that allows no selection
let sel = selector!(
    "MyEnum,
    flags: AllowNoneVariant,
    x=3, y=3, width=30"
);