Documentation‎ > ‎Menus‎ > ‎

    gnocl::menuCheckItem

    A menu item which changes between two states when clicked.

    Synopsis

    gnocl::menuCheckItem [-option value...]

    Screenshot

    Options

    -accelerator
    type: string
    Accelerator for this item, like "<Ctrl>A" or "<Shift><Alt>B".
    -active
    type: boolean (default: 0)
    Whether the widget is active.
    -data
    type: string
    User defined data which can be retrieved via the cget subcommand.
    -inconsistent
    type: boolean (default: 0)
    Whether the widget state is rendered inconsistent, for example if multiple items in an application are selected which do not have all the same state.
    -name
    type: string
    Name of the widget, can be used to set options in an rc file.
    -offValue
    type: string (default: 0)
    Value to store in the button's associated variable whenever this button is not selected
    -onToggled
    type: string (default: "")
    Tcl command which is executed if the radio button is toggled. Before evaluation the following percent strings are substituted:

    %w    widget name
    %d    widget data (previously stored with the value passed to the -data option)
    %v    value of the radio group
    -onValue
    type: string (default: 1)
    Value to store in the button's associated variable whenever this button is selected
    -sensitive
    type: boolean (default: 1)
    Whether or not the item is sensitve to user input.
    -text
    type: percent-string (default: "")
    Text or icon of the item.
    -tooltip
    type: string
    Message that appear next to this widget when the mouse pointer is held over it for a short amount of time.
    -variable
    type: string
    Name of a (global) variable which is changed when the state of the item changes.
    -visible
    type: boolean (default: 1)
    Whether or not the item is visible.

    Description

    A check item has two states: on and off. If the state is changed, it executes a command and sets a Tcl variable appropriately.

    Commands

    id cget option
    Returns the value for one option. The option may have any of the values accepted by configure.
    id configure [-option value...]
    Configures the widget. Option may have any of the values accepted on creation of the widget.
    id delete
    Deletes the widget and the associated tcl command.
    id onToggled
    Executes the command.

    Example

    set dog 1
    set cat 1

    set menu [gnocl::menu \
        -title "menuCheckItem"]

    $menu add [gnocl::menuCheckItem \
        -text "%_Has _Bird" \
        -variable bird]

    $menu add [gnocl::menuCheckItem \
        -text "%_Has _Dog" \
        -variable dog]

    $menu add [gnocl::menuCheckItem \
        -text "%_Has _Cat" \
        -variable cat]

    $menu popup

    results in



    Comments

    Sections