NB. menu examples
NB.
NB. load script, display MENU1 and MENU2 and try mx0, mx1, mx2.
NB.
NB. view script system\packages\menu.ijs for a description.

require 'menu'

a=. (;:'zero one two three four five') ,. <&> 0 1 2 3 4 5
b=. (;:'red blue green') ,. <&> 0 1 2
c=. ('rome';'';'paris';'berlin';'york') ,. <&> 0 1 0 1 0
d=. (<c) (<2;1)} b
e=. (;:'mon tues wed thurs frid sat sun') ,. <&> 7 $ 0 1 2 3 4
f=. (<d) (<0;1)} a
g=. (<e) (<3;1)} f
MENU1=: g

fifth__=: smoutput bind 'five selected'
ab=. a ,. 'wdinfo' ;"1 0 {."1 a
ab=. ('fifth__';'') (<5;2 3)} ab
cb=. c ,. 'wdinfo' ;"1 0 {."1 c
db=. (<cb) (<2;1)} b
fb=. (<db) (<0;1)} ab
gb=. (<e) (<3;1)} fb
MENU2=: gb

NB. =========================================================
NB. simple menu
mx0=: 3 : 0
200 200 wdmenu '|first||middle|last'
)

NB. =========================================================
NB. complex menu - returns selected position only
mx1=: 3 : 0
wdpclose 'menudemo'
wd 'pc menudemo;pcenter'
r=. wdmenu MENU1
wdpclose 'menudemo'
r
)

NB. =========================================================
NB. as mx1, but some selections invoke callbacks
mx2=: 3 : 0
wdpclose 'menudemo'
wd 'pc menudemo;pcenter'
r=. wdmenu MENU2
wdpclose 'menudemo'
r
)
