menus management

automatic menu
displ exec
See also


       In interaction mode there is a menu default OpenGL available on right click of the mouse.
       It is possible to define cascading dropdown menus OpenGL or dynamic.
       It is also possible to define type anyflo programmable menus.

menu; (without parameters): clears the input char buffer and makes full screen the anyflo window.

dropdown menus OpenGL

simple dropdown menus

The command interaction menu defines some cascading dropdown menus of type OpenGL:
interaction menu("f1 f2 ...")
       Menu box appears at the top of the main dropdown menu (on right click). Click on the drop down menu shows f1 f2 ... fi click on the box causes the execution of the anyflo function fi.

Sub dropdown menus

interaction menu(">sm1 f1_1 f1_2")
menu(">sm2 f2_1 f2_2")
menu(">sm1 sm2")

       Menu box appears at the top of the main dropdown menu (on right click). Click on the drop down menu shows sm1 sm2, click on the box sm1 shows the submenu sm1 f F1_1 F1_2, click on the box f1_i causes the execution of the anyflo function f1_i ().
Can declare submenus of submenus:
menu(">sm3 f1 f2")
menu(">sm4 f3 f4")
menu(">sm5 f5 f6")
menu(">sm6 f7 f8")
menu(">sm1 sm3 sm4")
menu(">sm2 sm5 sm6")
menu("sm1 sm2 f0")

sm1 et sm2 are submenus level 1, f0 is a function.
sm3 et sm4 are submenus level 2 of submenu sm1.
sm5 et sm6 are submenus level 2 of submenu sm2.
f1 et f2 are functions of submenu sm3.
f3 et f4 are functions of submenu sm4.
f5 et f6 are functions of submenu sm5.
f7 et f8 are functions of submenu sm6.
See an example in function menu_cascade.func.

Menus de type anyflo



Returne the names of the functions of the menu "MEN".


Returne the textes assocoated to the submenus of the menu "MEN".


Returns the list of function names (or submenus) called by the menu MEN.
Menu generation

     Generates a displayable menu in the graphic window:
fff is the list of the function names of the form:
     fi is the name of a function that is in memory or of a previous declared menu.
     >f1 indicates that f1 is an exclusive sub menu (which must be declared before). It must be a function f1() will be executed when calling this sub menu. When an exclusive sub menu is validated, all others exclusive sub menus are invalidated.
     &f2 indicates that f2 is an inclusive sub menu (which must be declared before). It must be a function f2() will be executed when calling this sub menu.
     .f3 indicates that f3 is a toggle function (turn on and off).
     !f4;!f5;!f6 indicates that f4 f5 f6 are alternative functions which only one is active (activation of one of them disables the other).
It's possible to declare several groups of alternative functions by putting several ! (up to 6). for example:
     =f7 indicates that f7 is of type toggle and will run continuously until it is validated.
     _f8 indicates that f8 is a C function.
     ?f9 indicates that f9 is a priority function (ie it alone is executed, which display a lot of information without encroaching on others).

ttt is the list of the box names of the form "t0;t1;t2;t3;t4;t5;t6". There must be exactly the same number of fi and ti.
     ti is the name appearing in box i of the menu and may be different from the name of the corresponding function fi.

tti and thi may include several lines by putting \n, example:
ti=" one case text\n on 2 lines".

poi(x,y): is the menu position.
A small grey frame is displayed in the left menu, click on it allows translate the position.
The sizes of the boxes depend on the length of texts and font.

When a box is enabled the colors of text and frame are reversed.
col(r,g,b): text color (white is default).
col(r1,g1,b1, r2,g2,b2, ...): text color of box i (white is default).
frame(r,g,b): framed boxes color (r,g,b) (white default).
frame(r1,g1,b1, r2,g2,b2, ...): framed boxe i color (ri,vi,bi) (white default).
exec(c1,...): boxes ci of the menu will be executable cyclically and automatically during ti images(option time).
rectangle(r,g,b): boxes filled of color (r,g,b) (black by default).
rectangle(r1,g1,b1, r2,g2,b2, ...): boxe i filled of color (ri,gi,bi) (black by default).
mouse(0): non-blocking read (default).
mouse(1): blocking read .
mouse(2): continous read (without click).
text(th): displayed text above a box when the mouse passes over them.
time(t1,...): boxes ci of the menu will be executable cyclically and automatically during ti images (exec option).

exec(c1,...)exec make immediate execution.

frame(r1,v1,b1, r2,v2,b2,rh2, ...), col(r1,v1,b1, r2,v2,b2, ...) as well as rectangle(r1,v1,b1, r2,v2,b2, ...) are used to color the boxes individually.
mouse(s1,s2,...) can assign different input modes on the boxes.

In order to force alternative functions they can been decalred as sub menus.
To facilitate the development the following protocol is recommended:
     give the same name to a box and the corresponding function (uppercase).
     call the main menu MEN.
     if a sub menu called SM, call SM_XXX boxes and dependent functions.
     External variables names begin with a capital.
     the first charactere of a function name should not be a _ (reserved for C functions).
(All demos respect this protocol).

See examples:

It is advisable do rem menu ("M") before changing the name of the M menu, otherwise the old name still correspond to a menu with boxes not necessarily correspond with existing functions.
In all case ini menu avoids problems.

rem menu("m") deletes the menu "m".
ini menu deletes all menus.

no menu

     Makes invisible menus.

no menu("SM")

     Makes invisible the submenu SM of a menu (as validate menu("SM")=0).

yes menu

     Makes visible menus (default).

yes menu("SM")

     Makes visible the submenu SM of a menu (as
validate menu("SM")=1).

validate menu

Validation of a function of a menu validate menu("f0")
     Returns the validation of function f0.
validate menu("f0")=v
     Changes this validation (0: off, 1: on).
inv validate menu("f0")
     Reverses this validation.
validate menu("f0")menu("fi")
     Returns the validation of function fi of menu f0. (> 0 if active, < 0 if passive, 0 if neutral).
validate menu("f0")menu("fi")=1
     ACtivates the function fi pf menu f0.
validate menu("f0")menu("fi")=0
     Inhibits the function fi of menu f0.
Note: "fi" may be replaced by the number of the box in the menu.
inv validate menu("f0")menu("fi") reverses the validation of function fi of menu f0.
Validation of a submenu of a menu
validate menu("MEN")menu("SM")=1; activates the submenu SM of menu ME.
validate menu("MEN")menu("SM")=-1; inhibits the submenu SM of menu ME and all functions and all submenus.


In a submenu "M_S" of a menu "M" this submenu can be referenced by:
or by:
       menu("M")menu(name func)
since name func is the name of the function just executed.

To return to the keyboard can:
Press the key escape
Or call a function in a menu like this:
end interaction;

2) The input menu are in blocking mode.


       Scales used to enter information graphics using the mouse:
Float or integer values of dimensions 1, 2 ou 3.
Color or view parameters.


The entry on a scale are non-blocking mode. It is the responsibility of the user to test whether the reading is changed, for example:

executer(n); will only be executed if a new value is read on the scale.

Automatic menu

Some menu functions fi of a menu nnn can be performed cyclically and automatically (although this menu is disabled) during ti images with the command exec(f1,f2,...)time(t1,t2,...)menu("nnn")exec.
lauchese an automatically execution of the functions numbered 2 and 3 of the sub menu MEN_SUB of the menu MEN respectively during 50 and 100 images.
See examples in test.func.

displ exec

The command displ exec can quickly build a simple menu.
w=displ exec("cube(1)dim(rand2(10,100));")poi(p)text(1,1)rectangle(0)frame(0,1);
p+=w[0],0;w=displ exec("f()")text(1,1)poi(p)rectangle(0)frame(0,1);
p+=w[0],0;displ exec("interaction STOP")poi(p)text(1,1)rectangle(0)frame(0,1);

Constructs a menu of 3 boxes executable:
The first builds a cube dimension random..
The second calls the function f().
And last returns to the interpreter mode.

See also

col menu
exec menu
frame menu
mouse menu
no menu
period menu
poi menu
rectangle menu
rem period menu
text menu
validate menu
yes menu