popupclick
LIST
,
INITIAL
,
CHOICE

The popupclick statement displays a pop-up menu at the current mouse location.


Parameters

This statement has three parameters:

list – Carriage return separated array of choices to appear in pop-up menu. You can also use the menu( function to construct the menu, allowing styles, submenus, etc.

initial – Initial choice to be selected in pop-up menu (or "" if no choice).

choice – Item user selected in pop-up menu (or "" if no choice). Note: If the menu was constructed with identifiers you can also use the info(“menuidentifier”) function to determine the chosen menu item.


Description

This statement can be used to produce a pop-up menu at the current mouse position. It is intended that this statement be used in a procedure that is triggered by a button on a form (or any form object that triggers a procedure). The procedure must be triggered on mouse down, not mouse up.

Here is an example that displays a pop-up menu with three colors when the button is clicked.

local colorChoice
popupclick "Red"+cr()+"Green"+cr()+"Blue","Red",colorChoice
if colorChoice = "" return endif // do nothing if user pulled off mouse
// colorChoice now contains the color name
if colorChoice="Red"
    .. do something redish
elseif colorChoice="Green"
    .. do something greenish
elseif colorChoice="Blue"
    .. do something blueish
endif

You can also use the menu( and menuitem( functions to create the menu, as shown in this example. This is more complicated but gives you more control – you can give menu items different colors or styles, or even include submenus in your pop-up menu.

local colorChoice
let colorMenu = menu("Colors")
    menuitem("Red","color","770000")+
    menuitem("Green","color","007700")+
    menuitem("Blue","color","000077")
popupclick colorMenu,"Red",colorChoice
if colorChoice = "" return endif // do nothing if user pulled off mouse
// colorChoice now contains the color name
if colorChoice="Red"
    .. do something redish
elseif colorChoice="Green"
    .. do something greenish
elseif colorChoice="Blue"
    .. do something blueish
endif

See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0.