This one is working fine and shows the menu at the cursor postion:
Code: Select all
popupmenu(<get selecteditemspathnames |>, x=-1, y=-1);corner of the screen.
Code: Select all
popupmenu(<get selecteditemspathnames |>, x=300, y=500);Code: Select all
popupmenu(<get selecteditemspathnames |>, x=-1, y=-1);Code: Select all
popupmenu(<get selecteditemspathnames |>, x=300, y=500);Code: Select all
popupmenu(<get selecteditemspathnames |>, 300, 500);Code: Select all
v10.50.0007 - 2011-11-02 19:40
+ Scripting got a new function.
Name: PopupMenu
Action: Pops a menu and returns the selected item.
Syntax: popupmenu(itemlist, [x=-1], [y=-1], [start=1], [count=-1], [flags=0], [sep_itemlist="|"], [sep_item=";"], [on_cancel=""])
itemlist: List of items separated by sep_itemlist.
Each item is made of a Caption and optionally a Data part, separated by sep_item: "Caption;Data"
x: X position; -1 to use current mouse X.
y: Y position; -1 to use current mouse Y.
start: Index of first item to show; 1 = first item.
count: Count of items to show; -1 = show all.
flags: 1: Return index (instead of caption/data).
sep_itemlist: Separates items; can have more than one char.
sep_item: Separates caption from data; can have more than one char.
on_cancel: String returned when menu is cancelled (ESC).
return: Data of selected item; caption if no data defined; index if flags AND 1.
Examples:
text popupmenu("a|-|b|c"); //- is a menu separator
text popupmenu("a;data returned on a|-|b;data b|c;data c");
text popupmenu(<get selecteditemspathnames |>);
Code: Select all
$a = "Execute with option x Xy XXyy";
$b = "Execute with option K VbDFccs";
$c = "Execute with option G BjfdUpa";
//popupmenu(itemlist, x, y, start, count, flags, sep_itemlist, sep_item, [on_cancel=""])
$r = popupmenu("Choose what to execute:| |$a|$b|$c|-|Cancel",-1,-1,,,1,,,"nix");
msg "You have chosen item no: $r";
if ($r==3){msg "OK, executing sub A.";}
if ($r==4){msg "You want sub B? OK.";}
if ($r==5){msg "...exec sub C.";}
if ("$r"=="nix"){msg "nothing chosen. ESC pressed or wrong clicked.";}