VtOptionMenu(VTCL)

VtOptionMenu(VTCL)


VtOptionMenu -- create an OptionMenu widget, return widget name

Syntax

VtOptionMenu object_name [options]

Description

Creates an Option Menu widget which is a menu system component that lets a user select one of several choices. Option Menus are created like Pulldown menus. First the Option Menu is created and then it is ``filled'' in with other widgets. (The Label class options are supported, so that the Option Menus can be titled.) Returns the Option Menu widget's name.

For example, to create an Option Menu with the options dog, cat, and frog:

set menu [VtOptionMenu $form.menu -label "Pick one:"
set but1 [VtPushButton $menu.but1 -label dog]
set but2 [VtPushButton $menu.but2 -label cat]
set but3 [VtPushButton $menu.but3 -label frog]
Callbacks can be assigned to the individual widgets which make up the Option Menu, or a callback can be assigned to the Option Menu itself. If this is done, callbacks assigned to the Option Menu children will be overridden and the Option Menu callback will be called if any of the children are activated. The child which caused the callback to be called will be passed as callback data.

Options

-callback cmd (C)
Sets callback cmd as the routine to call when any of the options are activated (by <Space>, <Enter>, or a single mouse click). This callback overrides any activation callbacks assigned to children of the option menu

Additional callback keys:

(selectedWidget
The name of the widget that activated this callback)

value
The name of the widget that activated this callback

-selectedWidget object_name ((SG)
Specifies the name of the widget that is selected in the option menu.

See also