MenuFunc()

Display a function menu in the panel window.

Usage

MenuFunc( name, node, par,
                    func, args=None, tooltip=None,
                    whatsthis=None, helpURL=None, redraw =False )

Parameters

name (string)
Label of the menu. This is displayed on the left.
node (string)
Data base path of the node containing the parameter.
par (string)
Parameter name. The value of the menu is extracted from this parameter under the above node, and upon change by you, the value is deposited therein.
func (function)
The function name that is connected to the function button.
args (tuple)
A tuple of arguments that will be passed to the func argument.
tooltip (string)
Tooltip help information, also known as bubble. The content of this argument is displayed in a small dynamic box placed opened above the menu, when the cursor remains at the menu for short time. This is typically a short phrase.
whatsthis (string)
Whatsthis help information. When you click on the whatsthis icon followed by clicking on this menu, a small box opens above the menu and the content of this argument is displayed in it. This is typically a short sentence or two, which provides more information than that given by the tooltip argument. The whatsthis argument is a rich text format, which means you can embed many of the HTML tags, such as <br> for line separator and <b> for bold.
helpURL (string)
This is the HTML-URL address containing detailed help on the menu item. When you press the F1 key while the cursor is on top of this menu, the assistance help system opens and displays this page.
redraw (boolean)
Flag specifying whether to redraw the panel when you change the value. This allows inclusion of complex menus that dynamically depend on the value of this menu.

Return Value

None

Errors

  • The parameter in the data base must be of type function.
  • The function must exist in the scope of this menu.

Description

This routine places a function menu in the panel window. The menu contains a label given by the name argument and a button. Clicking the button will cause the function specified by func to be run and args will pass to this function. The displayed value is extracted from the data base node and par. Upon change, the value is deposited back onto the data base. Now, if redraw is True, the entire panel is redrawn. This provides the opportunity to change the other menu selections. For example,
nodeAss = ROOT + RS + 'AUTO_SOLUTION_STRATEGY'
MenuFunc( name = 'Set solution strategy',
        tooltip = 'Set the solution strategy',
        whatsthis= 'Click this the button to automatically set\n'
                'the solution strategy\n'
                'You can then inspect or reset individual\n'
                'parameters by going to Advance Strategy\n',
        helpURL = URL + '#go',
        node = nodeAss,
        par = 'go',
        func = cmdDoAutoSolutionStrategy,
        args = () )