There are number of special comments for MGL script, which set some global behavior (like, animation, dialog for parameters and so on). All these special comments starts with double sign ##
. Let consider them.
v1 v2 [dv=1]
’Sets the parameter for animation loop relative to variable $0
. Here v1 and v2 are initial and final values, dv is the increment.
Adds the parameter val to the list of animation relative to variable $0
. You can use it several times (one parameter per line) or combine it with animation loop ##c.
Creates custom dialog for changing plot properties. Each line adds one widget to the dialog. Here $I is id ($0,$1...$9,$a,$b...$z), label is the label of widget, kind is the kind of the widget:
Now, it work in FLTK-based mgllab
and mglview
only.
You can make custom dialog in C/C++ code too by using one of following functions.
mglWnd
: void
MakeDialog (const char *
ids, char const * const *
args, const char *
title)
¶mglWnd
: void
MakeDialog (const std::string &
ids, const std::vector<std::string> &
args, const char *
title)
¶void
mgl_wnd_make_dialog (HMGL
gr, const char *
ids, char const * const *
args, const char *
title)
¶Makes custom dialog for parameters ids of element properties defined by args.
At this you need to provide callback function for setting up properties. You can do it by overloading Param()
function of mglDraw
class or set it manually.
mglDraw
: void
Param (char
id, const char *
val)
¶mglWnd
: void
SetPropFunc (void (*
prop)(char id, const char *val, void *p)
, void *
par=NULL
)
¶void
mgl_wnd_set_prop (void (*
prop)(char id, const char *val, void *p)
, void *
par)
¶Set callback function for properties setup.