defpopup

Defines a popup menu
Syntax

defpopup(<popup_name>)
{
    prologue <prologue_command>
    epilogue <epilogue_command>
    label(<text>)[(<expression>)][;]
    item(<text>[,<icon>])[(<expression>)]<command>
    popup(<text>[,<icon>])[(<expression>)]
    {
        <popup body>
    }
    extpopup(<text>,<name>[,<icon>])[(<expression>)][;]
    separator[;]
    ...
}

Description
Defines the popup menu <popup_name>. If the popup is aready existing it is cleared first then redefined again.
The popup is generated 'on the fly' when the popup command is called.
The 'item' keyword adds a menu item with visible <text> , the optional <icon> and <command> as code to be executed when the item is clicked. <text> is a string that is evaluated at popup call time and may contain identifiers and variables. If <expression> is given, it is evaluated at popup call time and if the result is 0, the item is not shown in the physical popup.
The 'popup' keyword adds a submenu with visible <text> , the optional <icon> and a popup body that follows exactly the same syntax as the defpopup body. The <expression> has the same meaning as with the 'item' keyword.
The 'extpopup' keyword adds a submenu with visible <text> , the optional icon and a popup body that is defined by the popup menu <name>. This basically allows to nest popup menus and define their parts separately. <icon> and <expression> have the same meaning as with the 'item' keyword.
The 'separator' keyword adds a straight line between items (separator).
The 'label' keywork adds a descriptive label that acts like a separator.
The 'prologue' keyword sets the <prologue_command> to be executed just before the popup is filled at popup command call.
The 'epilogue' keyword sets the <epilogue_command> to be executed just after the popup has been filled at popup command call.
<icon> is always an image identifier.
Please note that using this command inside the prologue , epilogue or item code of the modified popup menu is forbidden. In other words: self modification of popup menus is NOT allowed.
To remove a popup menu use this command with an empty body:

    defpopup(test){}
This will remove the popup 'test' and free its memory. Popups have a special kind of local variables that have an extended lifetime: these are called "extended scope variables" and are described in the Data structures documentation.
The syntax for these variables is:
%:<variable name>
These variables are visible during all the "visible lifetime" of the popup: from the popup command call to the moment in that the user selects an item and the corresponding code is executed (substantially from a popup call to the next one).
This allows you to pre-calculate data and conditions in the porologue of the popup and then use it in the item handlers or item conditions.
Examples
setmenu -q -i=2 Test apopup setmenu Test setmenu ThisDoesNotExist setmenu -q ThisDoesNotExist
See also
popup

Main index, Command index
KVirc 3.0.0 documentation
Generated by diego at Sat Jul 13 15:37:55 2002