File 'gui/gPopupMenu.cls' (part of 'Pool_GuiBase')

Description (short)
Generic popup menu widget
Written by
Andreas Kupries
Description
Generic popup menu widget
Keywords
popup, generic popup menu

Class 'genericPopupMenu'

Description
Instances of this class maintains a popup menu
Superclasses
widget
Options
command
Methods
public
InvokeEntry (command)
addEntries (spec)
addEntry (command underline name)
associate (w cmd)
createSubwidgets ()
entryconfigure (command args)
show (x y)
showRelative (w x y)
width ()
Membervariables
public
entries
entry

Options

-command
Script to execute upon invocation of a menu entry

Methods

InvokeEntry (command)

Internal method, called upon invocation of a menu entry.
Argument: command Symbolic name of the invoked entry.

addEntries (spec)

Adds a bunch of entries to the popup menu.
Argument: spec A list suitable for usage with 'array set'. The first item of each pair is the command code to give to the external script (command) upon invocation of the entry. It serves as symbolic name of the entry too. The 2nd item in each pair is the string to display in the entry. A command of '-' indicates a separator line. The display string is ignored in this case, but has to be present nevertheless. A command name has to be unique over all menubuttons added to a menubar.

addEntry (command underline name)

Adds a new menu entry to the popup menu.
Argument: command Symbolic name of command associated to the entry
Argument: underline (= -1) Index of the character in name to underline.
Argument: name (= {}) String to display in the new entry. The special value '-' forces generation of a separator line.

associate (w cmd)

Associate the popup menu with widget w, evaluate cmd upon invokation of a menu entry. The association takes the form of a binding of mouse button 2 causing the display of the menu relative to w.
Argument: w Path to the widget to add the menu to.
Argument: cmd Script to invoke upon activation of a menu entry. Changes command.

createSubwidgets ()

Overrides widget:createSubwidgets
Generate the internal widget. No placement yet, this is done later and explicitly (see show and showRelative)

entryconfigure (command args)

Accessor method allowing the reconfiguration of all entries in the menubar. Access is given based upon the symbolic name of the entry. The mapping to the menu widget of the entry and its index in that is done here.
Argument: command Symbolic name of the command to operate on.
Argument: args List of option, value pairs.

show (x y)

Show the popup menu and wait for selection or cancellation.
Argument: x Place to show the menu at, relative to the rootwindow of the display.
Argument: y Place to show the menu at, relative to the rootwindow of the display.

showRelative (w x y)

Show the popup menu and wait for selection or cancellation.
Argument: w Path to widget used as root of the coordinates.
Argument: x Place to show the menu at, relative to widget w.
Argument: y Place to show the menu at, relative to widget w.

width ()

Returns: Retrieve the width of the menu.


Membervariables

entries
Number of entries added so far.
initial value: 0
entry
Mapping from symbolic names to menu entries

Generated by AutoDoc 2.4 at 09/14/2000, invoked by Andreas Kupries