Macro dropdownlist

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

Creates a new dropdown list control for selecting from a list of items. The format is dropdownlist!("attributes") where the attributes are pairs of key-value, separated by comma.

§Parameters

  • class or type (required, first positional parameter) - The type of items to display in the dropdown
  • flags - Control flags (optional). Can be:
    • AllowNoneSelection - Allows selecting no value (None)
    • ShowDescription - Shows a description for each item
  • symbolsize - Size of the symbol displayed for each item (optional). Can be:
    • 0 - No symbol
    • 1 - Small symbol
    • 2 - Medium symbol
    • 3 - Large symbol
  • none - Text to display when no item is selected (optional)
  • 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 dropdown list
let dd = dropdownlist!("MyEnum, x=1, y=1, width=20");
 
// Dropdown with flags and symbol size
let dd = dropdownlist!(
    "type: MyEnum,
    flags: AllowNoneSelection+ShowDescription,
    symbolsize: 2,
    none: 'Select an option',
    x=2, y=2, width=25"
);
 
// Dropdown with custom none text
let dd = dropdownlist!(
    "MyEnum,
    none: 'No selection',
    x=3, y=3, width=30"
);