HyperWorks Tools

hwtk::menubutton

hwtk::menubutton

Previous topic Next topic No expanding text in this topic  

hwtk::menubutton

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

NAME

hwtk::menubutton - Create and manipulate menu widgets

 

 

DESCRIPTION

A hwtk::menubutton widget displays a textual label and/or image, and evaluates a command when pressed.

 

CLASS DIAGRAM

::hwtk::widget::HWMenubutton::hwtk::interface::HWIWidget::hwtk::interface::HWIBase::itk::Archetypedigraph HWMenubutton { layout = "dot"; rankdir = LR; ratio = "compress"; edge [color="#333333"] node [shape=rect, style="rounded,filled", fontname="sans-serif, serif", color="#000000", fillcolor="#FCFFF6", penwidth=0.5]; Archetype [label="Archetype", fillcolor="#FFF5FF", tooltip="::itk::Archetype", URL="../_auto/architecture.html"]; HWIBase [label="HWIBase", fillcolor="#E0FFFF", tooltip="::hwtk::interface::HWIBase", ]; HWIWidget [label="HWIWidget", fillcolor="#E0FFFF", tooltip="::hwtk::interface::HWIWidget", ]; HWMenubutton [label="HWMenubutton", fillcolor="#FFEAD8", tooltip="::hwtk::widget::HWMenubutton", URL="menubutton.html"]; Archetype -> HWIBase; HWIBase -> HWIWidget; HWIWidget -> HWMenubutton; }

SYNOPSIS

hwtk::menubutton - pathName ?option value? ...

 

STANDARD OPTIONS

-clientdata, clientData, ClientData

-compound, compound, Compound

-help, help, Text

-helpcommand, helpcommand, Command

-image, image, Image

-state, state, State

-text, text, Text

-textvariable, textVariable, Variable

-underline, underline, Underline

-width, width, Width

 

WIDGET-SPECIFIC OPTIONS

 

Command-Line Name: -direction

Database Name: direction

Database Class: Direction

Specifies where the menu will appear, relative to the menubutton. Acceptable values are:

above: The menu will pop up above the menubutton; if this would result in the menu being offscreen, it will pop up below the menubutton.
below: The menu will pop up below the menubutton; if this would result in the menu being offscreen, it will pop up above the menubutton.
left: The menu will pop up to the left of the menu button.
right: The menu will pop up to the right of the menu button.
flush: The menu will pop up directly over the menubutton.

 

Command-Line Name: -gridlayout

Database Name: gridlayout

Database Class: Layout

Specifies whether or not the menu should be displayed as a grid, containing images only. Acceptable values are 1 (menu will be displayed as a grid) and 0 (menu will be displayed as a list). The default value is 0, unless the menubutton is on a toolbar, in which case only grid layout is available.

 

Command-Line Name: -menu

Database Name: menu

Database Class: Menu

The menu associated with the menubutton.

 

Command-Line Name: -updateonselect

Database Name: updateOnSelect

Database Class: UpdateOnSelect

Specifies whether or not the menu button should be updated when a selection is made from the menu. A value of 1 designates that the button will be updated; a value of 0 designates that the button will not be updated.

 

WIDGET COMMAND

In addition to the standard configure, cget, identify, instate, and state commands, menubutton support the following additional widget commands:

pathName clear

Clears the menu button.

 

pathName item tag ?arg arg ...?

Adds an item to the menu button’s menu. Possible arguments are:

caption: The string to be displayed in the menu
command: A Tcl command to be invoked when the menu item is selected
accelerator: The keyboard shortcut for the menu item (“Ctrl + N”, “Alt + I”, etc.)
help: The string to be displayed as a tooltip, when the mouse hovers over the menu item
image: An image to accompany the text of the menu item

 

pathName itemcget tag ?arg arg ...?

Returns the current value of a configuration option for the entry given by index. Option may have any of the values accepted by the item widget command.

 

pathName itemconfigure tag ?arg arg ...?

Same as configure command. Items can be configured; supports only -state option of an item.

 

pathName itemdelete ?arg arg ...?

Deletes one or more items from the menu button.

 

pathName itemexists tag

Returns a value specifying whether or not the given item exists; returns 1 if the item exists, or 0 if it does not.

 

pathName itemlist

Returns a list of the items contained in the menu button.

 

pathName select ?arg arg ...?

Selects the specified menu item.

 

EXAMPLES

set dlg [hwtk::dialog .menuDlg]

set w [$dlg recess]

 

    hwtk::menubutton $w.t -text testing -image add-16.png -compound left

    pack $w.t;

 

    $w.t item new -caption "New" -command "puts New" -accelerator "Ctrl + N" -help New

    $w.t item open -caption "Open" -command "puts Open" -accelerator "Ctrl + O" -help Open

    $w.t item save -caption "Save" -command "puts Save" -accelerator "Ctrl + S" -image fileSaveModel-16.png -help Save

    $w.t item saveas -caption "Save As" -command "puts SaveAs" -accelerator "Ctrl + A"

    $w.t item separator

    $w.t item import -caption "Import"

    $w.t item model -caption "Model" -command "puts Model" -parent import -accelerator "Alt + I"

    $w.t item solver -caption "Solver Deck" -parent import -command "puts \"Solver Deck\""

    $w.t item abaqus -caption "Abaqus Deck" -parent solver -command "puts \"Abaqus Deck\""

    $w.t item permas -caption "Permas Deck" -parent solver -command "puts \"Permas Deck\""

    $w.t item separator -parent solver

    $w.t item radioss -caption "Radioss Deck" -parent solver -command "puts \"Radioss Deck\""

    $w.t item connectors -parent import -caption "Connectors" -command "puts \"Connectors\"" -image fileImportModel-16.png

    $w.t item load -caption "Load"

    $w.t item results -parent load -caption "Results" -command "puts Results"

    $w.t item up -parent load -caption "User Profile" -command "puts \"User Profile\""

    $w.t item run -caption "Run" -accelerator "Ctrl + r"

    $w.t item script -parent script -caption "Script" -command "puts Script"

    $w.t item separator

    $w.t item export -caption "Export"

    $w.t item emodel -parent export -caption "Model" -command "puts Model" -image fileExportModel-16.png

    $w.t item separator

    $w.t item exit -caption "Exit" -command "puts Exit" -accelerator "Alt + F4" -image closeReverse-16.png

 

$dlg post