Project

General

Profile

$submenu » History » Version 1

Per Amundsen, 08/14/2015 01:41 PM

1 1 Per Amundsen
_Added in 1.9.0_
2
3
*$submenu($id($1))*
4
5
Allows you to dynamically create a list of menu items, and can only be called from a [[Scripting_Menus|menu event]].
6
7
$id($1) - where $id() is the name of your identifier, and where $1 = 1, and increases by 1 with each call, adding whatever is returned by $id() to the popup menu.
8
9
The value that $id() returns must be a one line definition format for a popup menu.
10
11
The iteration ends when $id() returns no value.
12
13
The begin and end values are sent to check if the item should be enclosed in separators.
14
15
*Example*
16
17
<pre>
18
menu * {
19
 Animal
20
 .$submenu($animal($1))
21
}
22
23
alias animal {
24
 if ($1 == begin) return -
25
 if ($1 == 1) return Dog:echo Dog
26
 if ($1 == 2) return Cat:echo Cat
27
 if ($1 == 3) return Bird:echo Bird
28
 if ($1 == end) return -
29
}
30
</pre>