Abstract
This document describes the MDL (MeVisLab Definition Language) of MeVisLab and was published on 2011-09-03.
Table of Contents
List of Figures
List of Examples
This is a short introduction to the MeVisLab Definition Language (MDL), in which all *.def,
*.script and various other files for the MeVisLab are
written. The MDL is a configuration and layouting language, not a real
programming language. You can set tags and values for the tags, but there
are some extensions to this static scheme.
If found in *.def or *.script files, the
MDL is used for layouting the GUI of modules. That is the arranging of
fields implemented in C++ on a module panel or adding new fields and
functionality to modules, especially to macro modules.
Besides just layouting of fields for a module, the MDL offers also certain hubs for various calls of scripting methods (Python or JavaScript) on occasions like altering a field's value or opening a module's panel. Most MDL controls can be scripted with Python and JavaScript, a scripting link into the MeVisLab Scripting Reference is given where appropriate.
MDL is tag-based. Typically, a tag is set to a certain value or to a group of tags. There are also special tags to conditionally parse parts of a file or to test for miscellaneous conditions.
Setting a tag is simple:
TAGNAME = VALUE
The equal-sign ("=") has to be used between every tag and its value, except for groups, where it is optional (see "Groups"). TAGNAME as well as VALUE need to be a single token. If a token should contain whitespace, there are various ways to quote this value.
The most simple method is to enclose a value containing whitespace in parentheses:
myTag = "Example with whitespace and \"parentheses\" and a \\ backslash "
As you can see, parentheses and backslashes are escaped with backslashes, which can be annoying when you need to use many of them. There are two alternative ways to enclose long values that contain special characters:
// enclosing with "* *"
myScript1 = "*js:
function shakespeare () {
debug("2b | !(2b) => ?");
};
*"
// enclosing with @@
myScript2 = @@js:
function escaped () {
debug("*catch @ falling star*");
};
@@Inside strings starting with a parenthesis-star and ending with a star-parenthesis or inside of strings enclosed in double-@ (at) you can use all characters without escaping them except for the backslash char. Only if you want to use a sequence of characters that is the same as the ending of the used delimiters, you need to escape them with backslashes.
If you use any kind of quoting, you need to escape backslashes with a double backslash (\\).
Overview of quoting and the characters you need to escape with a backslash:
" ... "escape " with \" or use ' in Python or JavaScript instead
escape \ with \\
"* ... *"escape *" with *\"
escape \ with \\
@@ ... @@escape @@ with @\@
escape \ with \\
The different tags in the MDL have different data types. Those data types are listed here with a general explanation. A more detailed explanation can be found at the actual tags.
STRINGAn arbitrary description string. If the string contains spaces, it has to be enclosed in quotes.
The tag data of type STRING may be translated to other languages by an
internationalization mechanism.
This type is used as a control's name, as its title,
comment, whatsThis- and
toolTip text.
Examples:
title = SomeExampleTitle comment = "This example comment contains spaces"
STRINGLISTA list of strings, separated by commas. Since the single string entries are not allowed to contain spaces, the string list does not need to be enclosed in quotes.
The tag data of type STRINGLIST may be translated to other languages by an
internationalization mechanism.
This type is used for the genre and group tags.
Examples:
genre = Lung group = Release, LungPrivate
NAMEA unique identifier which must not contain spaces.
This type is used for identifying objects across script, scripting and C++ code.
Tags such as item, module,
DLL, field panel
or deprecatedName are of this type.
NAMELISTA list of unique identifiers, separated by commas. The unique identifiers must not contain spaces.
This type is used for the filter tag of the EventFilter.
To get a list of the possible values of the filter tag, use the auto-completion of the
texteditor MATE.
BOOLA Boolean value.
Possible values are Yes, No, True, False, On and Off.
UINTAn unsigned integer value.
INTAn integer value.
FLOATA floating point value.
FIELD_OR_FLOATEither a unique identifier of an existing number field or a floating point number.
This type is used for a field's min and max tags.
Example:
Interface {
Outputs {}
Inputs {}
Parameters {
Field maxValueField {
type = Float
value = 0
}
Field controlledField {
type = Float
value = 0
}
}
Description {
Field controlledField {
min = 0
max = maxValueField
}
}
ENUMOne of a fixed list of unique identifiers.
Have a look at the detailed description of tags of type ENUM for the possible
values and the default value. Also, the possible values are shown in MATE's auto-completion.
FIELDA unique and existing identifier of a field.
This type is used i.e., for the field tag of the Accel.
FIELDLISTA list of unique and existing field identifiers, separated by commas.
This type is used for the list of fields in the Persistence description.
FIELDEXPRESSIONA Boolean expression that is based on field values.
This type is used for the tags dependsOn and visibleOn.
Have a look at the examples of those tags for
a more detailed explanation.
PATHA relative or absolute path to a directory. If it is a relative path, useful variables are listed in Section 1.4, “Variables”.
The path delimiter is a "/", independent of the platform.
FILE
Same as PATH but with a specified file. This file can be i.e., a scripting file
(.py), an HTML file (.html) or a network file (.mlab).
SCRIPTA unique name of a scripting function implemented in a separated and included scripting file or a single line of scripting.
COLORA color definition, explained in more detail here.
KEYSEQUENCEA keysequence or shortcut to trigger certain functionality. The set string may be translated to other languages by an internationalization mechanism.
A KEYSEQUENCE is used in menus and in the Accel.
RICHTEXTA string containing HTML formatting.
This type is used in the TextView or similar controls.
A table with all supported HTML tags can be found in the chapter RichText.
FORMATSTRINGA C-like expression for formatting a (floating point) number.
Have a look at the NumberEdit control for more information.
REGEXPA regular expression for string matching.
This type is used in the LineEdit control for validating the entered string.
QTSLOTA Qt-slot which is triggered if a control emits a signal.
This type is used in the MenuItem.
Group tags are used for hierarchical tags. This means that you can build not only flat tag lists but also complete tree hierarchies. A group tag starts with a tag name, an optional value and an opening curly-brace, it ends with a closing curly-brace. Inside of the braces you can set normal tags with values or other group tags:
myGroup exampleGroup {
normalTag = "This is a normal tag"
groupInside {
insideTag = "Another example tag"
}
}
tagOnlyGroup {
normalTag = "This group has no value"
}Contrary to normal tags, a group tag does not need to have a value. The second example above shows a group that has only the tag name but no value, before the group is opened.
MDL has some predefined variables that are useful for its
purposes. To get the value of a variable, write its name inside a pair
of parentheses with a dollar sign prefix:
$(VARNAME).
The following variables are defined:
| LOCAL - Contains the full path of the currently parsed file. |
| HOME - Home directory of the user. |
| PackageIdentifier - Unique name, the structure is: "MLAB_PackageGroup_PackageName" |
In addition to these predefined variables, you can get the values of all tags from the mevislab.prefs file.
Variables in MDL can be escaped by writing $(*VARNAME*), which expands to $(VARNAME).
MDL allows you to include files with the #include statement. This is equivalent to pasting the given file at the position of the include statement:
#include $(LOCAL)/anotherfile.script
The same file can be included multiple times at different places in an MDL file. It is recommended to name included files either *.script or *.inc. You should not use the *.def extension, because this is reserved for module definition files and would be read automatically by MeVisLab on startup.
MDL allows to parse or skip parts of files depending on conditions. Additionally there are some statements that allow simple debugging and printing of messages.
#ifset and #ifnset are used
to test if a variable is set to one of the following values: true, on,
yes, 1 . If the variable is not set or has a different value, the block
is not parsed.
The variables can be defined in the mevislab.prefs file.
#ifset ApplicationAdvanced {
// if $(ApplicationAdvanced) is defined and set to true, on, yes or 1, parse inside this block
Field advancedField {}
}
#ifnset ApplicationAdvanced {
// if $(ApplicationAdvanced) is undefined or not set to true, parse the following block
Field normalField {}
}#ifdef and #ifndef are used
to test for existence of variables (and not its value)
#ifdef CPU {
// if $(CPU) is defined, parse inside this block
cpuTag = "$(CPU)"
}
#ifndef CPU {
// if $(CPU) is undefined, parse the following block
cpuTag = "CPU unknown"
}The #if statement is another conditional for
parsing blocks. With #if you can test the boolean
value of a variable or compare two variables as strings or numbers or
compare a variable with a static string. The following operations are
possible for compare: <, >, ==, >=, <=, !=
#if $(DEBUG) {
// Parse this if DEBUG is a variable and has the boolean value true
debugTag = "Debugging is fun"
}
#if "$(VERSION) >= $(MINVERSION)" {
// If the variables can be parsed as floating point numbers, make numeric comparison
// otherwise a lexical comparison is done
featureForVersion = true
}
#if "$(HOME) == $(LOCAL)" {
// Parse this if the current MDL file resides in the user's home directory
myHome = "is my castle"
}The #echo statement allows you to print out the value of variables or any other string to the console, which can be very useful for debugging:
#if $(DEBUG) {
#echo "HOME-Dir is $(HOME)"
}The #abort statement is used to print an error message and to stop the parser:
#ifndef DefaultFont {
#abort "No default font available!"
}Comments in MDL are the same as in C++:
// This is a comment before a tag myTag = myValue /* The following tags are not parsed, because they are inside a comment block tag01 = unparsed tag02 = unparsed */ anotherTag = anotherValue // Comment after Tag/Value Pair
Comments can be placed anywhere in the MDL file, but not between a tag and its value.
Although it is not needed by the parser, it is recommended to use tag names without whitespace and to separate words in tag names with uppercase characters. Both of the following examples are allowed, but the latter is recommended:
"Tag with four words" = "The Value" tagWithFourWords = "The Value"
You can use any character sequence for tag names as long as they are parsable as one tag. To start tag names with characters that end or start new syntactic constructs, for example "{" or "=", you have to enclose them in parentheses or use the same methods as for values.
MeVisLab supports three different types of modules, which are derived from an abstract module:
MLModule (an image processing module using the ML)
InventorModule (a visualization module derived from OpenInventor)
MacroModule (a macro module that encapsulates a internal network and has its own panel/script)
The following module tags are supported by all module types. Details on the different modules are given in the following sections.
Dynamic scripting: MLABModule
[MLModule|InventorModule|MacroModule] NAME {
genre = STRINGLIST
author = STRINGLIST
status = STRING
group = STRINGLIST
comment = STRING
keywords = STRING
exampleNetwork = FILE
seeAlso = STRING
documentation = FILE
scriptVersion = FLOAT
deprecatedName = STRING
hideModule = BOOL [No]
backgroundImage = FILE
externalDefinition = FILE
associatedTests = STRINGLIST
Interface {
Inputs {
Field NAME {...}
...
}
Outputs {
Field NAME {...}
...
}
Parameters {
Field NAME {...}
...
}
}
Description {
Field NAME {...}
...
}
Commands {
source = FILE
// more source tags...
initCommand = SCRIPT
wakeupCommand = SCRIPT
droppedFileCommand = SCRIPT
FieldListener [FIELD] { ... }
}
Deployment {
directory = PATH
...
file = FILE
...
module = NAME
...
DLL = NAME
...
}
Persistence {
fields = FIELDLIST
Module NAME {
fields = FIELDLIST
}
}
Window [NAME] {
...
}
// more windows...
}genre =
GENRENAMESspecifies one or more genre this module is in. Genres are separated by "," and have to be declared in the global genre file of MeVisLab. If a given genre is not defined, you will get a validator warning and the module is put into the "Other" genre. The genre tag is used to generate automatic entries in the Modules menu of MeVisLab and in the documentation. A module can be in multiple genres.
Example: genre = "Image, Diffusion"
see also: Section 3.1, “Module Genre Definition”
author =
STRINGLISTsets the author(s) of the module, starting with the primary author. Authors have to be separated by "," and should contain first and last name.
Example: author = "Florian Link, Bernd
Kuemmerlen"
However, if you list a single author, do not use the format "Last, First" as this results in a pair of authors with just one last name each. Just state the author's name with "First Last".
![]() | Warning |
|---|---|
Do not write anything except the authors' names in this tag, because the names are used for automatic documentation generation. |
status =
STRINGsets the status of the module.
Currently used words are:
Stable
Work-in-progress
Test
Deprecated
group =
STRINGLISTsets a list of group names separated by ",". If no group is set, the module is always visible in MeVisLab. If a list of groups is set, the module is only visible in MeVisLab if one of the groups is enabled in the MeVisLab prefs file (mevislab.prefs) via the "EnabledGroups" tag.
![]() | Note |
|---|---|
Visible means that the user can find the module in the search dialogs and in the Modules menu. The modules can still be loaded from a saved network or inside an application, even if they are not visible. |
Special groups:
- Release : if the string contains the keyword "release", the module is visible in the MeVisLab release version (otherwise it is not visible in the release, regardless of the other groups!)
- Deprecated : if the string contains the keyword "deprecated", you have to enable the "deprecated" tag to see the modules, regardless of the other groups
Examples:
group = Deprecated // module will only be visible if
"EnabledGroups" contains "deprecated"
group = Release // module will be visible in MeVisLab
release
group = LungPrivate // module will only be visible if
"EnabledGroups" contains "LungPrivate" and if MeVisLab is not in
release mode
group = Release, LungPrivate // module will only be
visible if "EnabledGroups" contains "LungPrivate"
comment
= STRINGsets a short comment which is shown in the MeVisLab help system and on the network.
(We recommend that you only write a short comment here and use the module documentation for further information.)
documentation = FILEThis tag is deprecated since MeVisLab 2.2.
It was used for referencing a HTML module help page that was not found at the default location
$(LOCAL)/html/ModuleName.html
The module help is now written with MATE and automatically generated by MeVisLab.
For more information: Section 22.9, “MATE as Module Help Editor”
keywords = STRINGsets keywords that are used in the MeVisLab search to find a module by its keywords. The keywords are separated by " ".
Make sure that you only use adequate keywords, otherwise your module will be found more often than wanted. Having no keywords decreases the possibility that someone finds the module.
exampleNetwork = FILEsets an example MeVisLab network that the user can open to see how the module could be used in connection with other module.
seeAlso
= STRINGsets a reference to other modules that are related to this module, separated by " ".
Example: seeAlso = "SoView2D
SoOrthoView2D"
externalDefinition = FILEdefines the module's windows etc. in an
external file, typically with the file extension ".script". It is
advised to use the naming convention $(LOCAL)/ModuleName.script if
you use this tag. The advantage of using this feature is that the
MDL file needs only be parsed when the module is really created
and not when MeVisLab is started. Make sure that you still provide
the simple tags (author, comment, etc.) in the *.def file so that
they are available when MeVisLab is started.
Example: externalDefinition =
$(LOCAL)/ModuleName.script
![]() | Tip |
|---|---|
This is typically used in MacroModules, especially when they are applications, to avoid that MeVisLab reads the whole application definition on startup. |
associatedTests = STRINGLISTspecifies a list of functional tests that are associated to the module.
Use the macro module TestCaseManager to generate new tests or to browse and modify existing tests.
See the document TestCenter Manual for more information about functional test cases for specific modules.
backgroundImage = FILEspecifies a background image that is used on the box drawn in the MeVisLab network (instead of the default image).
deprecatedName = STRINGdefines an old (deprecated) name for this module, so that networks that contain a module with this name can still be loaded even if the module name was changed.
hideModule = BOOL (default: No)sets whether the module should be hidden, which effectively means that it can neither be found nor created in MeVisLab. This can be used for debugging purposes to turn modules on/off.
The interface section is used to declare any extra fields of a module. While it is possible to use the interface section in a ML/InventorModule, it is typically only used for MacroModule, since the ML and Inventor modules get their fields automatically from C++. If you want to add a description for a C++ field, refer to the Description section.
The interface section can contain three subgroups: Inputs, Outputs and Parameters. Inputs and Outputs are typically Image, SoNode or MLBase fields, while the Parameters section typically holds parameter fields like floats, vectors, colors etc. The declared fields can be both standalone script fields or they can alias an internal field of the internal network of a MacroModule.
// script field:
Field NAME {
type = ENUM
value = STRING
comment = STRING
hidden = BOOL [No]
priority = INT [100]
editable = BOOL [Yes]
persistent = BOOL [Yes]
min = FIELD_OR_FLOAT
max = FIELD_OR_FLOAT
internalName = FIELD
legacyValue = STRING
removed = BOOL [No]
// for enums:
items {
item NAME {
title = STRING
deprecatedName = STRING
// more deprecatedName tags
}
...
}
// old deprecated enum syntax:
values = STRING
}type
= ENUMdefines the type of the field (is automatically given if
internalName is used).
Possible values:
String
Int, Integer
Float
Double
Bool
Trigger
Vec2f, Vector2f, Vec3f, Vector3f, Vec4f, Vector4f
Plane
Rotation
Color
Matrix
Enum
Sonode
Image
Mlbase
value = STRINGsets a default value for the field (will only be assigned when a module is newly created, NOT on reload of a module), will be overwritten by a stored value when loaded from a network.
legacyValue = STRINGsets a default value for the field when a module is loaded from a network and no value was specified for the field in the saved network. This allows to give a new default value with the value tag and to keep old networks working by setting a compatible legacyValue for old networks.
comment = STRINGsets a comment describing the field (which is shown at the input/output tool tip).
hidden = BOOL (default: No)sets whether the field should be visible in the MeVisLab network (this can be used to hide existing input/output images).
priority = INT (default: 100)sets the notification priority of the field. A value of 0 means that the field has high priority and GUI controls depending on this field will be updated immediately when the field changes.
editable = BOOL (default: Yes)sets whether the field should be editable by default. Also sets the
persistent attribute to the same value (if not
specified explicitly).
persistent = BOOL (default: Yes)sets whether the field value should be stored in networks (save to disk and copy+paste).
min =
FIELD_OR_FLOATsets a minimum value for the field, only works on Number fields. The value can be given as a float value or as the name of another field which provides and updates the minimum value if the min field changes.
max =
FIELD_OR_FLOATsets a maximum value for the field. It only works on Number fields. The value can be given as a float value or as the name of another field which provides and updates the maximum value if the max field changes.
removed = BOOL (default: No)declares this field as being removed (should only appear in the Description section) and avoids warnings when a network is loaded which contains stored values for the (removed) field.
internalName = FIELDdefines that the field should alias an internal field of the internal network of a macro module.
If the internal name is given, the type of the generated field cannot be
selected and is given by the internal field.
deprecatedName = NAMEsets an old name to the field which allows to rename
fields in MacroModules/C++ and keep old networks and scripts
working. If any deprecatedName appears anywhere in a GUI
description, a stored network or in scripting, it is
automatically mapped to the name of this field.
(Any number of deprecatedName tags can be set. They are
all parsed.)
itemsspecifies the enumeration items if the field is of type Enum.
item = NAMEspecifies the (token) name of the item.
specifies the user visible name of the item.
specifies an old deprecated name for the item which can be used on setStringValue and which causes the enum to take the value of item instead of the old value.
This tag is used to allow old networks and scripts to work even if enum items have changed or have gone away completely.
values = STRINGdefines the enum values in a comma-separated list
This tag is deprecated and should no longer be used, use items instead.
The Description section can be used in addition to the Interface section to assign extra properties to existing C++ fields. No new fields can be created in the Description section, only properties can be added to already existing fields.
Description {
Field NAME {
value = STRING
legacyValue = STRING
comment = STRING
hidden = BOOL [No]
priority = INT [100]
editable = BOOL [Yes]
persistent = BOOL [Yes]
min = FIELD_OR_FLOAT
max = FIELD_OR_FLOAT
deprecatedName = NAME
// for enums:
items {
item NAME {
title = STRING
}
deprecatedName = STRING
// more deprecatedName tags
...
}
...
}
}value = STRINGsets a default value for the field (will only be assigned when module is newly created, NOT on reloading a module), will be overwritten by a stored value when loaded from a network.
legacyValue = STRINGsets a default value for the field when a module is loaded from a network and no value was specified for the field in the saved network. This allows to give a new default value with the value tag and to keep old networks from working by setting a compatible legacyValue for old networks.
comment = STRINGsets a comment describing the field (which is shown at the input/output tool tip).
hidden = BOOL (default: No)sets whether the field should be visible in the MeVisLab network (this can be used to hide existing input/output images).
priority = INT (default: 100)sets the notification priority of the field, a value of 0 means that the field has high priority and GUI controls depending on this field will be updated immediately when the field changes.
editable = BOOL (default: Yes)sets whether the field should be editable by default. Also sets the
persistent attribute to the same value (if not
specified explicitly).
persistent = BOOL (default: Yes)sets whether the field value should be stored in networks (save to disk and copy+paste).
min
= FIELD_OR_FLOATsets a minimum value for the field. It only works on Number fields. The value can be given as a float value or as the name of another field which provides and updates the minimum value if the min field changes.
max
= FIELD_OR_FLOATsets a maximum value for the field. It only works on Number fields. The value can be given as a float value or as the name of another field which provides and updates the maximum value if the max field changes.
deprecatedName = NAMEsets an old name to the field which allows to rename
fields in MacroModules/C++ and keep old networks and scripts
working. If the deprecatedName appears anywhere in a GUI
description, a stored network or in scripting, it is
automatically mapped to the name of this field
(any number of deprecatedName tags can be given. They are
all parsed)
itemsspecifies the enumeration items if the field is of type Enum.
item = NAMEspecifies the (token) name of the item.
title = STRING
specifies the user visible name of the item.
deprecatedName = STRING
specifies an old deprecated name for the item which can be used on setStringValue and which causes the enum to take the value of item instead of the old value.
This tag is used to allow old networks and scripts to work even if enum items have changed or have gone away completely.
The commands section is used to add script files and commands to the module.
The general sequence for a module initialization is:
The detailed order is:
Creation of the internal C++ ML/Inventor class or loading the internal MeVisLab network of the MacroModule
Reading internal fields from C++
Creation of self/instanceName fields
Creation of Interface fields (given in the Interface section)
and parsing of tags in the Interface and Description section (except
for min/max values)
Restore of persistent stored fields (via setStringValue)
Loading of Python or JavaScript given in Commands source tags
Creation of min/max values (from the Interface and Description
section)
Creation of FieldListeners given in the Commands section
Field connections to other modules in a network that is restored (from disk or paste buffer) are done
Commands {
source = FILE
// more source files...
initCommand = SCRIPT
wakeupCommand = SCRIPT
finalizeCommand = SCRIPT
droppedFileCommand = SCRIPT
storingToUndoHistoryCommand = SCRIPT
restoredFromUndoHistoryCommand = SCRIPT
FieldListener [FIELD] { ... }
...
}source = FILEsets a script file to be loaded in the script context of this module. Python or JavaScript variables, classes and functions declared in the file are available in all script calls to this module. This tag can be used for multiple files, the files are parsed in the order of declaration
The file extension .py specifies Python
script files.
The file extension .js specifies JavaScript
script files.
Example: source =
$(LOCAL)/ModuleName.py
initCommand = SCRIPTdefines a script command that is called when the module is created on a network. At the time of this call, the field connections to other modules in the network have not yet been established.
wakeupCommand = SCRIPTdefines a script command that is called after the module is created on a network and all other modules have been also created and after all field connections have been established.
finalizeCommand = SCRIPTdefines a script command that is called when the module's script context is deleted. It can be used to cleanup resources that need to be removed or cleared.
This command is called when a module is reloaded or when it is finally deleted, which may occur later than expected because of the undo/redo buffer.
(Typically all Python and JavaScript resources are cleaned automatically, so you will probably never need this command.)
droppedFileCommand = SCRIPTdefines a script command that is called when the user drops a file on the module's box on the network (e.g., used in ImageLoad to accept dropped filenames).
storingToUndoHistoryCommand = SCRIPTdefines a script command that is called when a module is removed from the network and placed into the undo history
restoredFromUndoHistoryCommand = SCRIPTdefines a script command that is called when a module is readded to the network from the undo history
FieldListener [FIELD]the Commands section can contain multiple FieldListeners, see FieldListener for details on what a FieldListener can be used for. The listeners declared in the commands section are active after the module has been created until the module is deleted. This is typically used to provide functionality to a MacroModule's fields and react on field changes which are independent of the user interface. If you want to have a FieldListener that changes the user interface, use a FieldListener inside of a GUI control somewhere in a Window.
![]() | Note |
|---|---|
Scripting methods and functions without parameter can be called by a
If the called method or function needs parameters, the scripting string needs to be escaped:
|
This sections allows to make the values of internal fields of a MacroModule persistent. It allows to specify a list of fully qualified field names as well as fields grouped by internal modules. In contrast of defining a field on the interface of the macro module, only its value is stored and restored, the persistent fields are not available on the macro module interface. A typical use case is making internal settings persistent.
Persistence {
fields = FIELDLIST
...
Module NAME {
fields = FIELDLIST
...
}
...
}fields = FIELDLISTdefines the fields that are to be stored as a comma-separated list, typically modulename.fieldname (the tag can be used multiple times).
Module = NAMEdefines a section for fields of the given module (the tag can be used multiple times). The fields listed in the Module tag are given without the leading module name, since that is already given by the section.
This section allows to tell MeVisLab about dynamic dependencies
of the module that are required when the module should be deployed to
another computer. The ModuleDependencyAnalyzer
module allows to find most dependencies automatically, but if you e.g.
depend on other directories or if you add modules dynamically in your
module, you need to specify these in the Deployment section.
Deployment {
directory = PATH
...
file = FILE
...
module = NAME
...
DLL = NAME
...
}directory = PATHdefines an additional directory that this module depends on (tag can be used multiple times).
file = FILEdefines an additional file that this module depends on (tag can be used multiple times).
module = NAMEdefines an additional module that this module depends on (tag can be used multiple times).
DLL =
NAMEdefines an additional DLL that this module depends on (tag can be used multiple times).
Defines a module that contains an C++ image processing module that is derived from a Module in the ML.
Typically used tags can be found at Module.
Dynamic scripting: MLABMLModule
MLModule NAME {
class = NAME
DLL = NAME
projectSource = PATH
// tags from Module
}class
= NAME (default: same as MLModule NAME)sets the name of the C++ module that should be created via the ML runtime system.
![]() | Tip |
|---|---|
This can be used to have the same internal C++ class for a number of MeVisLab modules with different names and default values, or if you do not want the internal name to appear as the MeVisLab module name. |
DLL =
NAMEspecifies the dynamic load library where the C++ class for this module is defined in. The name is given without system-specific pre-/postfix.
Example: DLL = MLBase
projectSource = PATHspecifies the path to the project sources. This optional tag is used to make e.g. the *.dsp file available in the module's context menu and the ModuleInspector. MeVisLab looks for the *.pro file of the name (projectSource)/(DLL).pro to create/update the dsp if needed.
This option should not be needed if a project is placed within a package that is known to MeVisLab. If the project is located at some different place, however, use this option with either an absolute or a relative path.
Example (relative): projectSource =
$(LOCAL)/../../../../../Foo/Bar/MyProject
Example (absolute): projectSource =
$(MLAB_MY_PACKAGE)/Sources/ML/MyProject
defines a module that contains a C++ visualization module derived from an OpenInventor SoNode or SoEngine class.
Typically used tags can be found at Module.
Dynamic scripting: MLABInventorModule
InventorModule NAME {
class = NAME
DLL = NAME
projectSource = PATH
hasGroupInputs = BOOL [No]
hasViewer = BOOL [No]
hybridMLModule = BOOL [No]
// tags from Module
}class = NAME (default: same as
InventorModule NAME)sets the name of the C++ module that should be created via the OpenInventor runtime system.
![]() | Tip |
|---|---|
This can be used to have the same internal C++ class for a number of MeVisLab modules with different names and default values, or if you do not want the internal name to appear as the MeVisLab module name. |
DLL = NAMEspecifies the dynamic load library where the C++ class for this module is defined in. The name is given without system-specific pre-/postfix.
Example: DLL = SoView2D
projectSource = PATHsee MLModule.
hasGroupInputs = BOOL (default:
No)sets whether the module is derived from a SoGroup and should have dynamic SoNode inputs.
hasViewer = BOOL (default: No)sets whether the module should have a viewer (typically used on SoGroup derived nodes which should have an Inventor Viewer).
hybridMLModule = BOOL (default:
No)sets whether the InventorModule contains a fully functional MLModule whose fields appear as if they were the fields of the InventorModule. This is an advanced feature and should typically not be used.
defines a macro module which can contain an internal network. Typically a MacroModule has an Interface section which defines the fields of the macro. The fields can be aliased from internal fields or can be standalone fields.
Typically used tags can be found at Module.
MacroModules should use the externalDefinition tag to define their
Interface and Windows in an extra "ModuleName.script" file which
should be named like the module itself.
If the externalDefinition tag
is given, MeVisLab automatically loads the network with the same name
and the extension ".mlab". If the module only contains scripting and
does not require an internal network, use the scriptOnly tag to tell MeVisLab.
Dynamic scripting: MLABMacroModule
MacroModule NAME {
scriptOnly = BOOL [No]
onlyOneInstance = BOOL [No]
applicationSplashImage = FILE
// tags from Module
}scriptOnly = BOOL (default: No)sets wether an internal network is loaded/required.
onlyOneInstance = BOOL (default: No)sets whether only one instance of this module can be started as an application; additionally created versions just show the already running application. This is used for applications that the user should only be able to start once.
applicationSplashImage = FILEsets a splash image that is shown on a splash screen when the application is started. This is nice for big applications that need some time to initialize all scripts etc.
The FieldListener listens to fields and calls the script command
given in the command tag whenever the
field changes.
The fields are given as the value tag and/or with multiple
listenField tag.
There are two possible uses for a FieldListener:
They can be used anywhere in the control hierarchy of a Window.
1. If used in the Commands section, the FieldListener is active throughout the whole lifespan of a module instance (from creation to deletion) and reacts to any field changes whether there is an open module panel or not. Because of this, such a FieldListener cannot access the controls of the user interface of the module with scripting, just the fields of the module.
2. If used somewhere inside of a Window, the FieldListener
is an invisible user interface element which is only active (and
created) when the Window is actually created. Such a FieldListener
can access all other user interface controls within that Window
that are named using the ctx.control(name)
Python or JavaScript function.
![]() | Note |
|---|---|
Since part of a Window can be created multiple times using
the Panel GUI control, multiple
instances of the same FieldListener in a Window can exist at the
same time and will all work and change the user interface via
the |
FieldListener [FIELD] {
init = BOOL [No]
callLater = BOOL [No]
listenField = FIELD
// ...
command = SCRIPT
}listenField = FIELDlistens to the given field.
This tag can be used multiple times to listen to N fields with the same FieldListener
command = SCRIPT (arguments:
changedField)defines the script command that is executed when one of the fields changes. The changed field is passed as the first argument to the command.
init = BOOL (default: No)sets whether the command is triggered once when the FieldListener is created. The first of the fields it listens to is passed to the command.
![]() | Tip |
|---|---|
This is especially useful when the FieldListener updates some user interface control and needs to be initiated initially to provide a correct user interface. |
callLater = BOOL (default: No)sets whether the field listener is scheduled the next time the event loop is processed and not immediately when the field changes. You will only get one notification if multiple fields changed since the last event loop processing. If more than one field is listened to, the command is called without a field pointer, because the FieldListener does not know which of the fields have changed since the last event loop.
![]() | Warning |
|---|---|
Be careful, setting callLater to 'Yes' can cause infinite loops of field notifications! Only use it when you know what you are doing! |
A module in MeVisLab can be in part of multiple genres which are given with the genre tag. The available genres are given in MeVisLab/Standard/Modules/IDE/Genre.def and can also be extended via user genres.
Extract of Genre.def:
GlobalGenres {
Genre FileMain {
title = File
Genre = DICOM
Genre InventorFile {
title = Inventor
}
Genre File {
title = Misc
}
}
Separator = ""
Genre ImageMain {
title = Image
Genre = Info
Genre = Scale
Genre = Generators
Genre Image {
title = Misc
}
}
...
}Example of a module having two genres:
MLModule MyModule {
genre = DICOM,Scale
}If you are a MeVisLab core developer at MeVis, you can add genres in the Genre.def file.
If you are an external developer and you still need your own genres, you can add a UserGenres section to your *.def file (on the top level):
UserGenres {
Genre SomebodysGenreMain {
title = "A longer title for the genre"
Genre SomebodysGenre {
}
}
Genre +Diffusion {
Genre DiffExtra {
}
}
}As you can see above there are two notations:
1. Adding a new root genre by just giving a Genre tag with the name of the new genre.
2. Extending a known genre with new entries by writing a + and an existing genre name (defined in Genre.def).
Example: Genre +ImageMain { Genre = SomeNewSubGenre
}
![]() | Note |
|---|---|
UserGenres and GlobalGenres are only reloaded when MeVisLab is restarted or when the whole database is reloaded. |
A module in MeVisLab can be given the membership of one or several ModuleGroups via the group tag. A ModuleGroup consists of the group tag id and extra semantic information about this id given via the ModuleGroup tag. The id has to be a single word and should start with your license prefix to avoid mixing groups up. The existing groups can be enabled/disabled in the Preferences Panel of MeVisLab.
There are a number of predefined groups which are used throughout MeVisLab:
- deprecated = a modules that is officially gone,
only still there to make old stuff work.
- test = a module that tests MeVisLab
features.
- example = a module that shows things as an
example.
- internal = internal MeVisLab modules which are
not visible to the public.
To put your module into a defined group write the following:
MLModule SomeModule {
group = MyOwnGroup
}Now we need extra information on the ModuleGroup to make it appear nicely in the Preferences Panel of MeVisLab.
ModuleGroup GROUPNAME {
owner = STRING
title = STRING
comment = STRING
type = [internal | std]
shy = BOOL [No]
}If you are a MeVisLab core developer at MeVis, you can add your
ModuleGroups directly to
MeVisLab/Standard/Modules/IDE/ModuleGroups.def.
If you are an external developer, just put the additional ModuleGroups into any *.def file in you UserModulePath, they are read automatically.
Shared Libraries (DLLs) are loaded by MeVisLab when they are needed by a module in a network (see the DLL tag of Section 2.6, “MLModule”). The PreloadDLL tag can be used to force MeVisLab to load a given DLL on startup. This can be useful when your own ML Type Extensions should be loaded on startup of MeVisLab.
The PreloadDLL tag can appear in any *.def file (on the top-level, not nested in other tags):
PreloadDLL DLLNAME {}
// or
PreloadDLL = DLLNAMEThe DLLNAME is given without file extension. On Windows, ".dll" is appended in MeVisLab Release and "_d.dll" in MeVisLab Debug application. Mac OS X uses "libDLLNAME.dylib" to access the shared library. On Linux, "libDLLNAME.so" is used.
The following chapters give an overview of all possible GUI Controls and their tags. MeVisLab also contains a number of example MacroModules that demonstrate the individual features.
The following modules demonstrate the use of the most of the GUI controls. (This list may not be completely up-to-date, try searching for modules starting with Test* in the MeVisLab search.).
TestStyles - how to change the controls appearance (Colors,Fonts,...).
TestPrototypes - how to change tag defaults for given GUI controls.
TestLayouter - showing the usage of AlignGroups.
TestListView - showing a scripted ListView.
TestModalDialog - how to create a modal dialog.
TestHyperText - how to use RichText with hyper links.
TestDefaultStyle - showing the default spacings etc.
TestComboBox - showing a scripted ComboBox.
TestViewers - showing different Inventor viewers.
TestInventorChildren - showing how to add inventor nodes dynamically.
TestDynamicFrames - how to change Frame content via scripting.
TestTable, TestVertical, TestSplitterLayout, TestHorizontal
TestFieldAccess - script access to field values, especially vectors, matrices and image properties.
TestScriptUtils - showing the use of global script utility functions.
TestTimers - how to create scripted timers.
![]() | Tip |
|---|---|
As an all-in-one example module, the ExampleGUIScripting module should be studied thoroughly. |
Abstract controls cannot be created directly in the MDL, but many concrete GUI controls are derived from these controls to provide their basic behavior/tags.
Control is the base class for all GUI controls and provides a
number of tags supported by every control. Some tags given here only
make sense when used in the context of a layouter, e.g., colspan in Table or x/y in Grid.
Dynamic scripting: MLABWidgetControl
name = NAME panelName = STRING expandX = ENUM [No] expandY = ENUM [No] stretchX = INT [0] stretchY = INT [0] visible = BOOL [Yes] enabled = BOOL [Yes] dependsOn = FIELDEXPRESSION visibleOn = FIELDEXPRESSION style = NAME styleSheetString = STRING styleSheetFile = FILE w = INT h = INT pw = INT ph = INT mw = INT mh = INT maxw = INT maxh = INT fw = INT fh = INT // Control tags that are read by the owning layouter control: x = INT y = INT x2 = INT y2 = INT posX = INT posY = INT scale = INT [1] colspan = INT [1] alignX = ENUM [Auto] alignY = ENUM [Auto] // layouter tags for inter control alignment: alignGroupX = NAME (alias: alignGroup = NAME) alignGroupY = NAME childAlignGroupX = NAME (alias: childAlignGroup = NAME) childAlignGroupY = NAME labelAlignGroup = NAME tooltip = STRING whatsThis = STRING droppedFileCommand = SCRIPT droppedObjectCommand = SCRIPT acceptDrops = BOOL resizeCommand = SCRIPT initCommand = SCRIPT destroyedCommand = SCRIPT bgMode = ENUM [Repeat] editBgMode = ENUM buttonBgMode = ENUM screenshotCommentCommand = SCRIPT
style
= NAMEdefines the style to be used for this control (and for its children, if there are any).
see also DefineStyle
styleSheetString = STRINGsee styleSheetFile, uses the given string instead of reading the CSS definition from a file
styleSheetFile = FILEdefines the Qt style sheet that should be used for this MDL control and all its children.
Please note that this tag gives you direct access to the underlying Qt Style Sheets and that you should not mix using style sheets and the MDL style tag in the same MDL controls, since the effects that can happen are somewhat undefined. This results in the duality of QPalette/QFont (which are used for the MDL style tags) and Qt Style Sheets which do not work well together (which is a known Qt pitfall we can not do anything about).
The Qt Style Sheet feature offers complete styling of the MDL controls, but it requires some knownledge of the underlying Qt widgets. For simple styling purposes, you should better use the MDL style tag instead. For complete styling of the GUI (e.g., changing the look&feel of TabView, ListView, ...), the Qt Style Sheets provide possibilities far beyond what the MDL style tag offers.
See http://doc.qt.nokia.com/4.6/stylesheet.html for full details.
panelName = NAMEsets a name for this control that can be used by the Panel component to reference this control as a cloned panel in some other GUI.
expandX = ENUM (default: No)defines the space requirements of a control. It depends on the layouter (e.g., Vertical, Table, etc.) how this requirement is met.
Possible values: Yes, No, True, False, 0, 1, Fixed, Minimum, Maximum, Preferred, MinimumExpanding, Expanding, Ignored
| Value | Meaning |
|---|---|
Fixed (aliases: 0, No,
False) | The control can never grow or shrink (e.g., the vertical direction of a button). |
Minimum | The preferredWidth is minimal, and sufficient. The control can be expanded, but there is no advantage to it being larger (e.g., the horizontal direction of a button). It cannot be smaller than the preferredWidth. |
Maximum | The preferredWidth is a maximum. The control can be shrunk any amount without detriment if other controls need the space (e.g., a separator line). It cannot be larger than the preferredWidth. |
Preferred | The preferredWidth is best, but the control can be shrunk and still be useful. The control can be expanded, but there is no advantage to it being larger than preferredWidth (the default expandX value). |
Expanding (aliases: 1, Yes,
True) | The preferredWidth is a sensible size, but the control can be shrunk and still be useful. The control can make use of extra space, so it should get as much space as possible (e.g., the horizontal direction of a horizontal slider). |
MinimumExpanding | The preferredWidth is minimal, and sufficient. The control can make use of extra space, so it should get as much space as possible (e.g., the horizontal direction of a horizontal slider). |
Ignored | The preferredWidth is ignored. The control will get as much space as possible. |
expandY = ENUMdefines the space requirements of a control. It depends on the layouter (e.g., Vertical, Table, etc.) how this requirement is met.
Possible values: Yes, No, True, False, 0, 1, Fixed, Minimum, Maximum, Preferred, MinimumExpanding, Expanding, Ignored
See expandX for an analogous explanation of the values.
visible = BOOL (default: Yes)sets whether the control is visible initially. It
can be set to (in-)visible later by using the
setVisible(bool) method on the
control.
enabled = BOOL (default: Yes)sets whether the control is enabled. It can be
changed by using setEnabled(bool) on the
control.
dependsOn = FIELDEXPRESSION visibleOn = FIELDEXPRESSIONmakes the control dependent on the given expression. If the expression changes its Boolean value, the control is automatically enabled/disabled (for dependsOn) or shown/hidden (for visibleOn).
The following operators are supported (precedence in order of appearance):
( )
parentheses
&& ||
or/and logical expression (lazy-evaluated)
== !=
comparison, Boolean fields and expressions are compared as Boolean, string values are compared as strings. If the right hand side is a regexp, the left hand expression is matched to the regexp.
!
unary not that can be used in front of parentheses and Boolean fields
fieldName
the name of a field (may also be a qualified name with modulename.fieldname)
Bool Fields are interpreted as their bool value, all other fields are interpreted as their string value.
"String"
a string constant that is given in parentheses. Note that there is no way of quoting " inside of a string at the moment.
/regexp/[i]
a regular expression, the optional i after the closing / makes the expression case insensitive
Regular expression can only be used on the right hand side of a comparison.
Note that there is no way of quoting / inside of a string at the moment.
Examples:
// normal Boolean field dependency: dependsOn = someBoolField // negated normal Boolean field dependency: dependsOn = !someBoolField // enable only when enum field has given string value: dependsOn = "* someEnumField == "SomeValue" *" // enable only when enum field has given string value and the bool field is true: dependsOn = "* someEnumField == "SomeValue" && someBoolField *" // enable only when enum field contains one of the given values: (using a regexp) dependsOn = "* someEnumField == /(SomeValue|SomeOtherValue)/ *" // enable only when enum field is identical to one of the given values: (using a regexp) dependsOn = "* someEnumField == /^(SomeValue|SomeOtherValue)$/ *" // the above can also be written with a number of compares, note that due to the // precendence, no parenthesis are needed: dependsOn = "* someEnumField == "SomeValue" || someEnumField == "SomeOtherValue" *"
![]() | Tip |
|---|---|
When you use string constants inside the expression, it is easiest to quote the MDL string with "* ... *" so that you do not have to escape the individual quotes of the string. |
w = INT
(alias: width) h = INT (alias: height)sets the width/height in pixels (this implicitly sets the minimum and preferred size).
pw = INT
(alias: preferredWidth) ph = INT (alias: preferredHeight)sets the preferred width/height in pixels.
![]() | Tip |
|---|---|
Not all controls currently support preferred width, some controls have their own default sizes. |
mw = INT
(alias: minimumWidth) mh = INT (alias: minimumHeight)sets the minimum width/height in pixels (a control cannot get any smaller than this size).
maxw =
INT (alias: maximumWidth) maxh = INT (alias: maximumHeight)sets the maximum width/height in pixels (a control cannot get any bigger).
fw = INT
(alias: fixedWidth) fh = INT (alias: fixedHeight)sets all above width/height sizes to the same value (the control will not change size in any layouter).
scale
= INT (default: 1)scales all sizes (margin/spacing/fonts) in fixed steps.
Positive integer values enlarge the control, negative values shrink it.
This is also applied to all child controls of a widget, so you can scale whole groups of controls with one scale tag.
This feature works additive and recursive , so you can also resize in a hierarchy.
![]() | Tip |
|---|---|
This feature replaces and extends the old ILAB4 defaultSmall, defaultBig, ... styles, which should no longer be used. |
alignGroupX = NAME (alias: alignGroup)childAlignGroupX = NAME (alias: childAlignGroup) childAlignGroupY = NAMElabelAlignGroup = NAMEsee Section 4.9.1, “Align Groups”for details on the usage of these tags
alignGroupY = NAMEspecifies that this control is in a vertical aligngroup.
see Section 4.9.1, “Align Groups”for details on the usage
Control tags that affect the control's layouters (depending on in which layouter the control is created, e.g., Table, Grid, ...):
alignX = ENUM (default: Auto)specifies the alignment of the control, which automatically means that the control is not expanded in that direction but aligned in its row/column.
This tag is used by the layouters a control is placed in, e.g., Table , Grid , Vertical and Horizontal.
Possible values: Auto, Left, Right, Center
alignY = ENUM (default: Auto)specifies the alignment of the control, which automatically means that the control is not expanded in that direction but aligned in its row/column.
This tag is used by the layouters a control is placed in, e.g., Table , Grid , Vertical and Horizontal.
Possible values: Auto, Top, Bottom, Center
x/y = INTsets the column/row position of control in the Grid.
(Grid layouter only, required tag!)
colspan = INT (default: 1)sets the column span used in Table layouter.
bgMode = ENUM (default: Repeat)editBgMode = ENUMbuttonBgMode = ENUMdefines how background images in the style colors bg , editBg and button are drawn. The default is repeating of the image which Qt grants us for free. All other modes have some kind of performance or memory penalty, but can give nice background effects. Especially the "smooth" modes are expensive.
Stretch, SmoothStretchStretches the image to the current size of this control.
StretchX, StretchY, SmoothStretchX,
SmoothStretchYStretches the image in X/Y direction, repeat in the other direction. This can be used to have a gradient effect with an image.
Fit, SmoothFitResizes the image so that it fits in the available space while keeping the aspect ratio. The border is filled with the color given in the style.
TopLeft,TopRight,BottomLeft,BottomRight,CenterImage is positioned in corner/center of control and not resized.
RepeatImage is repeated continuously (so the image used should match nicely with its borders).
ResizedBox (Advanced!)Image is split in 9 parts which are stretched differently, *ModeBorderX + *ModeBorderY tags select the corner box size that is not stretched.
Possible values: Repeat, Stretch, SmoothStretch, Fit, SmoothFit, TopLeft, TopRight, BottomLeft, BottomRight, Center, ResizedBox
For specification of background images, see the Style section.
Advanced features:
droppedObjectCommand = SCRIPTdefines a script that is executed when an object is dropped onto the control.
arguments: (qobject object)
acceptDrops = BOOLsets whether the object accepts dropping of objects. If one of the above commands is set, this is automatically set to 'Yes'.
Typically this is set to 'Yes' manually, if you want to handle drag-and-drop on a very low level, e.g., with an EventHandler.
resizeCommand = SCRIPTdefines a script that is executed whenever the control is resized on the screen. This can be used to make other controls visible/invisible, depending on the available space. It can also be used to do your own layouting in a FreeFloat by repositioning controls whenever the size of the FreeFloat changes. See the EventFilter for other things that you can react on.
arguments: (none)
initCommand = SCRIPTdefines a script that is executed when the control was created (and before it is actually shown). The control is passed with the call of the script.
arguments: (MLABWidgetControl)
destroyedCommand = SCRIPTdefines a script that is executed immediately before the control is destroyed. At this point the control is already reduced to the basic control object, so you cannot use any feature provided by derived controls! The control is passed with the call of the script.
arguments: (MLABWidgetControl)
Additional control tags for TabViewItems are given in TabViewItem, any control can be used as a TabViewItem.
Frame is an abstract control which allows to set tags that control the frame appearance. A number of controls are derived from this control.
Frame is derived from Control.
Dynamic scripting: MLABFrameControl
frameShape = ENUM [NoFrame] frameShadow = ENUM [Plain] frameLineWidth = INT [1] frameMidLineWidth = INT [1] frameMargin = INT [1]
frameShape = ENUM (default: NoFrame)sets the shape of the frame, the possible values are:
NoFrame, Box, Panel, WinPanel, HLine, VLine, StyledPanel, PopupPanel, MenuBarPanel, ToolBarPanel, LineEditPanel, TabWidgetPanel, GroupBoxPanel, MShape
frameShadow = ENUM (default: Plain)sets the type of the frame's shadow, the possible values are:
Plain, Raised, Sunken, MShadow
Execute can be used to execute a script function anywhere in a GUI definition. It can be placed in any Control that supports children. It does not create a visible control but just executes the given scripting function which may be defined via the source tag in the Commands section of the module. For Python, it is also allowed to execute inline code that starts with "py:" (and for JavaScript, the line needs to start with "js:"). The given function can also be a child of an existing object written in dotted notation, e.g., "myObject.myFunction".
Execute = someFunction
Execute = "*js: MLAB.log("test") *"
Execute = "js: MLAB.log('test') "The Execute statement has access to all controls that are "named" with the name tag and that appear BEFORE the Execute statement. Controls following after the Execute statement cannot be reached. An example for accessing a Control is given below.
![]() | Note |
|---|---|
Generally it is not a good idea to use inline code, because it messes up your GUI interface. It is not possible to define your own functions and classes in the inline code, so you should prefer doing the scripting in external files given via source. |
Label = "Test" { name = mylabel }
Execute = "*js: ctx.control("label").setTitle("Title Changed"); *"The following controls group other control together and define how these child controls are laid out. Window is a special case, since it is the top level control and can only be declared on the top level of a module definition.
Window is the base control that contains any other controls. A module can have any number of Windows in its MDL definition file. The first window (or the one with the name "_default") is used as the standard parameter panel of the module.
Window is derived from Control.
Dynamic scripting: MLABWindowControl
Window NAME {
title = STRING
wakeupCommand = SCRIPT
shouldCloseCommand = SCRIPT
maximized = BOOL [No]
fullscreen = BOOL [No]
borderless = BOOL [No]
ANYGUICONTROL { }
...
}title =
STRINGsets the title shown in the window title bar.
wakeupCommand = SCRIPTdefines a command that is called when the window is shown, you should better use an Execute command, which is also called when your Window is extracted via a Panel control.
shouldCloseCommand = SCRIPTdefines a command that is called when the window is closed by the user or by the program. If you do not want the window to be closed, you can call
ctx.window().setCloseAllowed(false)
within the script command. The default is that the window is closed.
maximized = BOOL (default: No)sets whether the window will always be shown maximized on the screen.
fullscreen = BOOL (default: No)sets wether the window will always be shown fullscreen, with no window bar decoration and close button.
borderless = BOOL (default: No)sets wether the window will have no decoration at all, no close button etc.. Use with care because you cannot close such a window without adding your own close button to it.
ANYGUICONTROLControls defined inside the window are the content of the window. If more than one control is specified, the window automatically uses a TabView and the controls act as TabViewItems.
Example 4.1. Window
Have a look at the View3D.script
(instantiate a View3D module in MeVisLab, right-click it and choose
Related Files → View3D.script from the context menu). There, you will find four
Window sections defined, namely 'View3D', 'Viewer', 'Settings' and
'LutEditor'. All these windows appear in the module's context menu
under 'Show Window' below the separator. Above the separator, the
default window (always called 'Panel') and the automatic panel are
listed.
In the case of the View3D, no Window is named
_default, so the first window ('View3D') is opened as
the default panel on double-clicking the module.
Interface {
Inputs {
// ...
}
Outputs {
// ...
}
Parameters {
// ...
}
}
Description {
// ...
}
Persistence {
// ...
}
Commands {
source = $(LOCAL)/View3D.js
wakeupCommand = wakeup
ContextMenu {
MenuItem "Show Inventor Inputs" { field = inventorInputOn }
}
FieldListener renderer.image {
// ...
}
// ...
}
Window View3D {
// ...
}
Window Viewer {
Viewer viewer.self {
name = viewer
clone = No
}
}
Window Settings {
Panel {
panel = Settings
}
}
Window LutEditor {
title = "Lut Editor"
Vertical {
Box Editor {
Panel {
module = SoLUTEditor
panel = editor
}
}
Box Settings {
Field SoLUTEditor.relativeLut { }
Field SoLUTEditor.alphaFactor { slider = Yes }
Field SoLUTEditor.colorInterpolation { }
}
Box Range {
Panel {
module = SoLUTEditor
panel = range
}
}
}
}Vertical is a vertical layout group control. Each control inside of the Vertical is laid out according to its size requirements.
The following children's tags are taken into account:
Vertical is derived from Frame.
Aliases: VerticalNB, Category
Dynamic scripting: MLABVBoxControl
Vertical {
spacing = INT [0]
margin = INT [0]
// Additional tags: see Frame
ANYGUICONTROL { }
...
}ANYGUICONTROLall controls declared inside of the group are automatically children of the group.
Example 4.2. Vertical
Have a look at the module TestVerticalLayout. This module features some GUI components that are arranged vertically.
Horizontal is a horizontal layout group control. Each control inside of the Horizontal is laid out according to its size requirements.
The following children's tags are taken into account:
Horizontal is derived from Frame.
Aliases: HorizontalNB, ButtonGroup
Dynamic scripting: MLABHBoxControl
Horizontal {
spacing = INT [0]
margin = INT [0]
// Additional tags: see Frame
ANYGUICONTROL { }
...
}ANYGUICONTROLall controls declared inside of the group are automatically children of the group.
Example 4.3. Horizontal
Have a look at the module TestHorizontalLayout. This module features some GUI components that are arranged horizontally.
Table organizes its children in rows. Child controls can span multiple columns and can be aligned within their row/column position.
Each control inside of the Table is laid out according to its size requirements, the following children tags are used by the layouter:
stretchX/Y, expandX/Y, alignX/Y, colspan
Table is derived from Frame.
Dynamic scripting: MLABTableControl
Table {
spacing = INT [0]
margin = INT [0]
// Additional tags: see Frame
Row {
ANYGUICONTROL { }
...
}
Row {
ANYGUICONTROL { }
...
}
...
}Example 4.4. Table
Have a look at the module TestTableLayout. Below you will find the MDL code that defines this example macro module.
scriptOnly = Yes
Window {
title = "GUITest: Table"
Table {
margin = 5
spacing = 3
Row {
Button {
colspan = 3
title = "TopLeft 3"
expandX = Yes
expandY = Yes
}
Button {
colspan = 2
title = "TopRight 2"
expandX = Yes
expandY = Yes
}
}
Row {
Button {
colspan = 2
title = "MidLeft 2"
expandX = Yes
expandY = No
}
Button {
colspan = 1
title = "MidCenter 1"
expandX = No
expandY = Yes
}
Button {
colspan = 2
title = "MidRight 2"
expandX = Yes
expandY = No
}
}
Row {
Button {
colspan = 2
title = "BottomLeft 2"
expandX = Yes
expandY = Yes
}
Button {
colspan = 3
title = "BottomRight 3"
expandX = Yes
expandY = Yes
}
}
Row {
Label "Resize this Window!" {
colspan = 5
alignX = Center
}
}
} // wrap
} // WindowGrid organizes its children in rows and columns. Child controls can be positioned at any row/column position and can span multiple columns and can be aligned within their row/column position.
Each control inside of the Grid is laid out according to its size requirements, the following children tags are used by the layouter:
stretchX/Y, expandX/Y, alignX/Y, x,
y, x2, y2
Grid is derived from Frame.
Dynamic scripting: MLABGridControl
![]() | Tip |
|---|---|
Each child control needs to have a In contrast to Table, where controls are automatically ordered in rows, the Grid allows more complex positioning. |
Grid {
spacing = INT [0]
margin = INT [0]
// Additional tags: see Frame
// simple control:
ANYGUICONTROL { x = INT y = INT }
// multicolumn control:
ANYGUICONTROL { x = INT y = INT x2 = INT y2 = INT }
...
}Example 4.5. Grid
Have a look at the module TestGridLayout. Below you will find the MDL code that defines this example macro module.
scriptOnly = yes
Window {
title = "GUITest: Grid"
Grid {
margin = 5
spacing = 3
Button {
x = 0
y = 0
x2 = 2
Y2 = 0
title = "<0,0>-<2,0>"
expandX = Yes
expandY = Yes
}
Button {
x = 3
y = 0
x2 = 3
y2 = 2
title = "<3,0>-<3,2>"
expandX = Yes
expandY = Yes
alignX = Right
}
Button {
x = 0
y = 1
title = "<0,1>"
expandX = Yes
alignX = Left
}
Button {
x = 1
y = 1
title = "<1,1>"
expandY = Yes
alignY = Top
}
Button {
x = 2
y = 1
x2 = 2
y2 = 2
title = "<2,1>-<2,2>"
expandX = Yes
expandY = Yes
}
Button {
x = 0
y = 2
x2 = 1
y2 = 3
title = "<0,2>-<1,3>"
expandX = Yes
expandY = Yes
}
Button {
x = 2
y = 3
x2 = 3
y2 = 3
title = "<2,3>-<3,3>"
expandX = Yes
expandY = Yes
alignY = Bottom
}
} // Grid
} // WindowButtonBox is a control that presents Button controls in a layout that is appropriate for the operating system's look & feel. Dialogs typically present buttons in a layout that conforms to the interface guidelines for that platform. A ButtonBox automatically uses the appropriate layout of the user's desktop environment, and may change the order in which the child buttons appear.
Dynamic scripting: MLABButtonBoxControl
ButtonBox {
orientation = ENUM [Horizontal]
// Button control:
Button { role = ENUM }
...
}orientation = ENUM (default:
Horizontal)sets the the orientation of the button box.
Possible values: Horizontal, Vertical
Buttonspecifies a Button control. The role attribute of a Button is used to determine the role of the button within a dialog window. See Button control for possible values.
If the button does not specify a role, the button title will be evaluated for know role strings. Currently known strings are: Ok, Open, Save, Cancel, Close, Discard, Apply, Reset, Restore Defaults, Help, Save All, Yes, Yes To All, No, No To All, Abort, Retry, Ignore
Splitter organizes its children in vertical or horizontal direction and allows to resize the contained controls with draggable handles. The color and shadow of the splitter are customizable.
Each control inside of the Splitter is laid out according to its size requirements. The following children tags are used by the layouter:
Splitter is derived from Frame.
Dynamic scripting: MLABSplitterControl
Splitter {
direction = ENUM
color = COLOR
shadow = ENUM [Raised]
// Additional: tags for frame
ANYGUICONTROL { }
...
}Example 4.6. Splitter
Have a look at the module TestSplitterLayout. Below you will find the MDL code that defines this example macro module.
scriptOnly = Yes
Window {
title = "GUITest: Splitter"
w = 512
h = 384
Splitter {
direction = Vertical
Button {
title = "1"
expandX = Yes
expandy = Yes
}
Splitter {
direction = Horizontal
Button {
title = "2"
expandX = Yes
expandy = Yes
}
Splitter {
direction = Vertical
Button {
title = "3"
expandX = Yes
expandy = Yes
}
Splitter {
direction = Horizontal
Button {
title = "4"
expandX = Yes
expandy = Yes
}
Splitter {
direction = Vertical
Button {
title = "5"
expandX = Yes
expandy = Yes
}
Splitter {
direction = Horizontal
Button {
title = "6"
expandX = Yes
expandy = Yes
}
Splitter {
direction = Vertical
Button {
title = "7"
expandX = Yes
expandy = Yes
}
}
}
}
}
}
}
} // Splitter
} // WindowBox shows a frame with a title around its children. It can
contain any inner layout, which is selected by the layout tag. If no layout is chosen, a Vertical is implicitly used.
Box is derived from Frame.
Dynamic scripting: MLABBoxControl
Box STRING {
title = STRING
alignTitle = ENUM [Left]
layout = NAME [Vertical]
checked = BOOL [No]
checkable = BOOL [No]
checkedField = FIELD
// Additional: tags for frame
ANYGUICONTROL { }
...
}title =
STRINGoverwrites the title given in Box tag.
alignTitle = ENUM (default: Left)sets the alignment of the title.
Possible values: Left, Center, Right
layout =
NAME (default: Vertical)defines a layouter.
Possible values: Vertical, Horizontal, Table, Grid, Splitter, FreeFloat
checkedField = FIELDcheckedField can be a Boolean field. Its value is used to toggle the checked state which enables/disables the content of the box.
checkable = BOOL (default: No)sets whether a checkbox appears in the title of the box which enables/disables the content of the box.
checked = BOOL (default: No)sets the checked state which indicates if the content of the box is enabled or disabled. This attribute will be overwritten if checkedField is given.
Note: There is a known Qt bug that causes the box contents to overlap with the checkbox if the box has no title
Example 4.7. Box
Have a look at the module TestBoxLayout. Below you will find the MDL code that defines this example macro module.
scriptOnly = yes
Window {
title = "GUITest: Box"
Vertical {
margin = 5
Label "A Box with title and automatic layout:" {}
Box BoxTitle {
spacing = 5
margin = 5
Button { title = "A Button" }
Button { title = "B Button" }
Button { title = "C Button" }
}
Label "A Box without title and grid-layout:" {}
Box {
spacing = 2
margin = 2
layout = Grid
Button { title = "A Button" x = 2 y = 0}
Button { title = "B Button" x = 1 y = 1}
Button { title = "C Button" x = 0 y = 2}
}
} // Vertical
} // WindowScrollView allows to scroll a bigger control with vertical and horizontal scrollbars. If not layout is specified, the internal layout is a Vertical layout.
ScrollView is derived from Frame.
Dynamic scripting: MLABScrollViewControl
ScrollView {
layout = NAME [Vertical]
hscroller = ENUM [Auto]
vscroller = ENUM [Auto]
// Additional: tags for frame
ANYGUICONTROL { }
...
}hscroller = ENUM (default: Auto)sets whether the horizontal scrollbar is always on, off or should only appear when needed (auto).
Possible values: Auto, On, Off
vscroller = ENUM (default: Auto)sets whether the vertical scrollbar is always on, off or should only appear when needed (auto).
Possible values: Auto, On, Off
layout = NAME (default: Vertical)defines a layouter.
Possible values: Vertical, Horizontal, Table, Grid, Splitter, FreeFloat
Example 4.8. ScrollView
The following example adds another window to the View3D which then becomes available via the module's context menu (Show Window). It adds the settings panel in a ScrollView with no horizontal scroller but a vertical scroller if the panel's content exceeds the window (which it does).
Window ScrollViewTest {
ScrollView {
hscroller = Off
vscroller = Auto
Panel {
panel = Settings
}
}
}TabView shows a TabBar and contains a stack of controls that are visible depending on the selected Tab. It also offers a mode where the TabBar is not visible, allowing to change the selected Tab by scripting only (this is often used in applications, which group their panels inside an invisible TabView).
The child controls of the TabView can be any controls. The additional tags needed for the TabView are given as extra tags to the child controls. Refer to TabViewItem to see what tags are available.
The selected tab can be changed by using the
selectTabAtIndex(int) or
selectTab(controlname) method on the
TabView.
TabView is derived from Control.
Dynamic scripting: MLABTabViewControl
TabView {
mode = ENUM [Normal]
ANYGUICONTROL { }
...
}mode =
ENUM (default: Normal)defines whether the TabBar is visible and if it is on the top or bottom of the widget. If the mode is "toolbox", a ToolBox widget is used instead of a TabView; this has the advantage of internal scrollbars and the possibility of long tab description.
Possible values: Normal, Top, Bottom, Left, Right, Invisible, Toolbox
ANYGUICONTROLeach control in the TabView is treated as a TabViewItem and can contain the tags given in TabViewItem
Example 4.9. TabView
Have a look at the module TestTabViewLayout. This module features the use of an invisible TabView where the tabs are changed by using scripting commands that are triggered by pressing a button, and the use of standard tabs.
Note that each direct child of a TabView is turned into an own tab.
scriptOnly = yes
Commands {
source = $(LOCAL)/TestTabViewLayout.js
}
Window {
title = "GUITest: TabViews"
Vertical "TabView with invisible Tabs" {
Box Select {
layout = Horizontal
Button { title = "Boxes" command = switchTab0 }
Button { title = "Table" command = switchTab1 }
Button { title = "TextView" command = switchTab2 }
}
TabView {
name = TabViewInvisible
mode = Invisible
Vertical {
tabTitle = "Boxes"
margin = 5
Box BoxTitle { ... }
Label "A Box without title and grid-layout:" {}
Box BoxTitle { ... }
} // Vertical
Table { ... }
TextView {
tabTitle = TextView
title = TextViewExample
text = "Example for a TextView-Control in a TabView"
} // TextView
} // TabView
}
TabView "TabView with visible Tabs" {
Vertical "Boxes" {
margin = 5
Box BoxTitle { ... }
Label "A Box without title and grid-layout:" {}
Box BoxTitle { ... }
} // Vertical
Table "Table" { ... }
} // Horizontal
} // WindowThe TabViewItem can be used inside of a TabView to specify the TabView entries. Any other control can also act as a TabViewItem in the TabView, just add the tags below to the control to pass the needed information to the TabView.
The TabViewItem is a Vertical layouter and has the following tags:
Dynamic scripting: MLABVBoxControl
TabViewItem STRING {
tabIcon = FILE
tabTitle = STRING
tabInitial = BOOL
tabTooltip = STRING
tabSelectedCommand = SCRIPT
tabDeselectedCommand = SCRIPT
tabEnabled = BOOL [Yes]
tabDependsOn = FIELDEXPRESSION
ANYGUICONTROL { }
...
}tabIcon = FILEset an icon to show on the TabBar.
tabTitle = STRINGsets a title to use in the TabBar (overwrites the value of the TabViewItem tag).
tabInitial = BOOLselects a TabViewItem as the initially selected Tab (otherwise the first Tab is selected).
tabTooltip = STRINGsets a tool tip text on the TabBar.
tabSelectedCommand = SCRIPTdefines a script command that is called when this TabViewItem is selected (also called on the initial selection).
tabDeselectedCommand = SCRIPTdefines a script command that is called when this TabViewItem is deselected.
tabEnabled = BOOL (default: YEs)sets whether this tab is initially enabled.
tabDependsOn = FIELDEXPRESSIONsets whether this tab is enabled depending on the given field expression. Have a look at the example of this tag for a more detailed explanation.
FreeFloat organizes its children at a given integer position. The coordinate system starts with (0,0) in the upper left corner.
Each control inside of the FreeFloat is positioned with the tags:
The size of the controls is taken from the width/height tags:
FreeFloat is derived from Frame.
Dynamic scripting: MLABFreeFloatControl
![]() | Tip |
|---|---|
The FreeFloat should ONLY be used where no other layouter works, since it offers fixed control positioning, which can have undesired effects when the font size etc. changes. It can be used nicely to have a title image and some floating buttons on the image. |
FreeFloat {
autoSize = BOOL
// Additional: tags for frame
ANYGUICONTROL { }
...
}User input control are typically tightly coupled with field in MeVisLab, thus allowing an easy way to represent a module's parameter field with a desired user interface. If not stated, all controls are derived from Control and offer its tags.
Field is a very generic control that can show any of the fields
in MeVisLab as an editable GUI element. It typically shows a label
with the field name (or a given title) followed by a number of user-editable
controls, e.g., LineEdit, NumberEdit, VectorEdit, ColorEdit, Slider
etc.
It also allows to have field connections by using drag-and-drop of the title label and a pop-up menu to work on the underlying field. Whether drag-and-drop is turned on depends on the window the control is used in. If it is an application window, drag-and-drop is automatically disabled.
Dynamic scripting: MLABFieldControl
Field FIELD {
title = STRING
titleField = FIELD
edit = BOOL [Yes]
slider = BOOL [No]
pressedIndicatorField = FIELD
editField = BOOL [Yes]
format = STRING
minLength = INT [5]
hintText = STRING
trim = ENUM [None]
sunkenVectorLabels = BOOL [Yes]
editAlign = ENUM [Left]
textAlign = ENUM [Left]
step = FLOAT
stepstep = FLOAT
sliderSnap = FLOAT
spacing = INT [0]
alignGroup = STRING
enumAutoFormat = BOOL [Yes]
comboBox = BOOL [No]
comboCompletes = BOOL [Yes]
comboSeparator = STRING [,]
comboField = FIELD
comboItems {
item {
image = FILE
title = STRING
}
...
}
applyButton = BOOL [No]
browseButton = BOOL [No]
browseMode = ENUM [Open]
browseTitle = STRING
browseFilter = STRING
browseSelectedCommand = SCRIPT
useSheet = BOOL [Yes]
fieldDragging = BOOL
updateFieldWhileEditing = BOOL [No]
}title =
STRINGtitle shown on field label.
titleField = FIELDsets the title as a field; it is automatically updated when the field changes and shows the field's string value.
step =
FLOATsets a step value used for NumberEdits.
stepstep = FLOATsets a stepstep value used for NumberEdits. The stepstep value is usually smaller than the step value.
sliderSnap = FLOATset a snap value for the slider. If set to a value != 0, the slider always snaps to a value that is a multiple of this value starting at the sliders minimum.
edit =
BOOL (default: Yes)sets whether the fields value can be edited. If set to 'No', typically text labels are used instead of editable GUI elements.
(This is different from the general Control tag enabled, which enables or disables a
whole control (also called "grayed out").)
slider
= BOOL (default: No)sets whether a slider is shown. This only works if the field is a number field and has min and max values.
pressedIndicatorField = FIELDspecifies a Boolean field that is set to true if the user presses the slider button and to false if the user releases the slider button.
editField = BOOL (default: Yes)sets whether the GUI element is editable, typically is used to enable the slider without the NumberEdit to the left.
format
= STRINGsets a format string to be used as in sprintf, e.g., %4.5f or %x
![]() | Note |
|---|---|
You have to use the right %d,%x ,%f,%g type for float/double/int fields. |
minLength = INT (default: 5)sets a minimum width of characters reserved in the editable GUI element.
hintText = STRINGsets a hint text shown in editable line edit if line edit is empty and does not have the focus.
updateFieldWhileEditing = BOOL (default: No)sets whether the attached field is updated while the user types text in the line edit.
trim =
ENUM (default: None)does trimming on the string when it is not edited.
Possible values: Left, Center, Right, None
Left: "...LongText"
Center: "Long...Text"
Right : "LongText..."
None: No trimming
sunkenVectorLabels = BOOL (default:
Yes)sets whether labels are drawn into the same frame as the LineEdit, otherwise they are drawn separately.
editAlign = ENUM (default: Left)defines the alignment of the text in the Line/NumberEdits. Default depends on whether numbers or strings are edited.
Possible values: Left, Right, Center
textAlign = ENUM (default: Left)defines the alignment of the text in the title label.
Possible values: Left, Right, Center
alignGroup = STRINGsets a hint to which other Fields this Field should be aligned. If the Control should never be aligned, use "None". This is a general feature and is explained in detail in Section 4.9.1, “Align Groups”
enumAutoFormat = BOOL (default: Yes)sets whether enum fields should avoid automatic formatting of enumeration names. Automatic formatting means that a field called "MyName" receives the automatic title "My Name". If the enum items have a common prefix, this is also stripped when automatic formatting is active.
comboBox = BOOL (default: No)sets whether a comboBox is used instead of LineEdit.
comboCompletes = BOOL (default: Yes)sets whether auto complete is used when editable.
comboField = FIELDspecifies a field whose string value is used instead of given
comboItems. When the comboField
changes, the available combo list is updated.
comboSeparator = STRING (default:
",")sets a string value to use for splitting the string value of comboField into individual values.
comboItemsspecifies the items shown in the ComboBox, may be omitted if
comboField is given.
Each item is specified with the item tag.
Each item entry can contain the following tags:
applyButton = BOOLsets whether an apply button is generated for VectorEdit. Typically only Rotation has an Apply Button automatically, otherwise it is off by default.
browseButton = BOOL (default: No)sets whether an additional browse button is generated that opens a file dialog at current field value (path).
browseMode = ENUM (default: Open)specifies the type of the file dialog.
Possible values: Open, Save, Directory
browseTitle = STRINGsets the title of the button for the file dialog
browseFilter = STRINGspecifies the file extension filter that is used in open and save mode. You can specify the file types as follows:
browseFilter = "All C++ files (*.cpp *.cc *.C *.cxx
*.c++);;Text files (*.txt);;All files (*)"
Filters are separated by double-semicolon. The filter is a space-separated list of glob-style expressions enclosed in braces that follow the textual description of the filter.
browseSelectedCommand = SCRIPTdefines the script command to be evaluated when the user made a selection with the file dialog.
useSheet = BOOL (default: Yes)sets whether any attached dialog (e.g., file dialog) is created as a sheet on Mac OS X. A sheet is a modal dialog attached to a particular document or window.
spacing = INT (default: 0)sets the internal spacing between the GUI elements of a FieldControl.
wrap =
BOOLsets whether step and stepstep wrap the value around when reaching the boundaries.
fieldDragging = BOOLsets whether the dragging of the fields label onto other field label is possible to create connections. The default is 'Yes' for normal panels and 'No' for standalone applications. This also turns on the connection icons and enables the field context menu on field labels.
// Different layouts can be used with certain types of fields: // // MLABStringField: // ---------------- // FieldLabel | <- LineEdit -> | [Browse/Save Button] // // If "edit" is 'No', LineEdit is just a Label // // MLABBoolField: // ---------------- // FieldLabel | CheckBox // (CheckBox is without label on right) // // MLABInt/Float/DoubleField: // -------------------------- // FieldLabel | NumberEdit | [<- Slider if min/max is set and "slider" tag is 'Yes' ->] // // If "edit" is 'No', NumberEdit is just a Label // // MLABEnumField: // -------------- // FieldLabel | ComboBox // // MLABTriggerField: // -------------- // FieldLabel | Button // // MLABColorField: // -------------- // FieldLabel | ColorEdit // // MLABVec2f/3f/4f/Plane/RotationField: // ------------------------------------------ // FieldLabel | x | NumberEdit | y | NumberEdit | z | NumberEdit | d | NumberEdit | [Apply Button] // // Naming for labels: // MLABVec2f: x,y // MLABVec3f: x,y,z // MLABVec4f: x,y,z,t // MLABRotation: x,y,z,r // MLABPlane: x,y,z,d // // If "edit" is 'No', NumberEdits are just Labels
FieldLabel shows the draggable label that is used in the Field control. It may be used if one wants to allow a drag/drop connection, e.g., of a matrix, and does not want to show the value of the field.
FieldLabel FIELD {
title = STRING
titleField = FIELD
}Button shows a clickable button that can either trigger a
MLABTriggerField or MLABBoolField or that can call a script given as
command tag. The button can have
multiple images for the different states and it can be a normal or a
toggle button.
Dynamic scripting: MLABButtonControl
![]() | Tip |
|---|---|
You can use & in the button title to add an ALT keyboard shortcut binding to a button. The respective letter will be underlined (e.g., "&Ok"). |
Button [FIELD] {
title = STRING
titleField = FIELD
role = ENUM [ActionRole]
image = FILE
accel = KEYSEQUENCE
border = BOOL [Yes]
autoRepeat = BOOL [No]
normalOnImage = FILE
normalOffImage = FILE
activeOnImage = FILE
activeOffImage = FILE
disabledOnImage = FILE
disabledOffImage = FILE
globalStop = BOOL [No]
popupMenu {
// See definition of SubMenu
}
command = SCRIPT
}title =
STRINGsets the title on the button.
titleField = FIELDsets the title as a field. The title string is automatically updated when the field changes and shows the field's string value.
role = ENUM (default: ActionRole)defines the role of the button in the window/dialog. It is evaluated if the button has been placed within a ButtonBox container.
Possible values are:
AcceptRoleClicking the button causes the dialog to be accepted (e.g., OK).
RejectRoleClicking the button causes the dialog to be rejected (e.g., Cancel).
DestructiveRoleClicking the button causes a destructive change (e.g., for Discarding Changes) and closes the dialog.
ActionRoleClicking the button causes changes to the elements within the dialog.
HelpRoleThe button can be clicked to request help.
YesRoleThe button is a "Yes"-like button.
NoRoleThe button is a "No"-like button.
ApplyRoleThe button applies current changes.
ResetRoleThe button resets the dialog's fields to default values.
image =
FILEspecifies a pixmap to use on the button.
accel =
KEYSEQUENCEsets a CTRL or ALT key sequence that activates this button. For normal ALT keyboard shortcuts, use the & notation in the title string.
Example:
accel = Ctrl+U
border
= BOOL (default: Yes)sets whether the buttons have a border.
autoRepeat = BOOL (Default: No)sets whether the button sends repeated clicked signal when user holds button.
normalOnImage = FILEnormalOffImage = FILEactiveOnImage = FILEactiveOffImage = FILEdisabledOnImage = FILEdisabledOffImage = FILEspecifies a different images for all states of the button.
popupMenudefines a pop-up menu to show on button press.
globalStop = BOOL (default: No)sets whether this button can be used as a global stop button, so that current ML calculations can be stopped by clicking this button.
To check buttons for a stop request in the scripting, you
have to call MLAB.shouldStop() regularly in you
scripting loop. This returns true if a stop button was
pressed.
command = SCRIPTdefines a script command that is executed when the button is pressed/toggled.
ToolButton is a quick access button which is typically used in
ToolBars. It can have an additional pop-up menu that pops up after a
given delay. It has mainly the features from Button, but additionally supports autoRaise, which lets the border be
highlighted when the mouse moves over it. The title is typically not
shown. It can either trigger a MLABTriggerField or MLABBoolField or
can call a script given as command
tag. The button can have multiple images for the different states and
it can be a normal or a toggle button.
Dynamic scripting: MLABToolButtonControl
ToolButton [FIELD] {
image = FILE
title = STRING
textPosition = ENUM [Bottom]
autoRepeat = BOOL [No]
autoRaise = BOOL [No]
autoScale = BOOL [No]
accel = KEYSEQUENCE
scaleIconSetToMinSize = BOOL [No]
normalOnImage = FILE
normalOffImage = FILE
activeOnImage = FILE
activeOffImage = FILE
disabledOnImage = FILE
disabledOffImage = FILE
globalStop = BOOL [No]
popupMenu {
// See definition of SubMenu
}
popupDelay = FLOAT
command = SCRIPT
}title = STRINGsets a title string on the button (typically not shown).
image = FILEspecifies a pixmap to use on the button.
textPosition = ENUM (default:
Bottom)sets the position of the title relative to the image.
Values: Right, Bottom
accel = KEYSEQUENCEsets a CTRL or ALT key sequence that activates this button. For normal ALT keyboard shortcuts, use the & notation in the title string.
Example:
accel = Ctrl+U
autoRepeat = BOOL (default: No)sets whether the button sends repeated clicked signal when user holds button.
autoRaise = BOOL (default: No)sets whether the border is shown only on mouse over.
autoScale = BOOL (default: No)scales the images to the MeVisLab global default tool button size.
scaleIconSetToMinSize = BOOL (default:
No)if autoScale is set to 'Yes' and this tag is also set to 'Yes', the Images from the following six ImageTags are not scaled to the default tool button size but to the minimum size of the tool button as set by the tags mw and mh:
normalOnImage = FILEnormalOffImage = FILEactiveOnImage = FILEactiveOffImage = FILEdisabledOnImage = FILEdisabledOffImage = FILEspecifies different images for all states of the button.
popupMenudefines a pop-up menu to show on button press.
popupDelay = FLOATsets the delay to show the pop-up.
Set this to 0.01 or smaller to disable the delay. Values above will result in the default value for the platform (legacy support).
globalStop = BOOL (default: No)defines whether this button can be used as a global stop button, so that current ML calculations can be stopped by clicking this button.
To check buttons for a stop request in the scripting, you
have to call MLAB.shouldStop()regularly in you
scripting loop. This returns true if a stop button was
pressed.
command = SCRIPTdefines a script command that is executed when the button is pressed/toggled.
CommonButtonGroup cannot be used directly. It implements the common functionality for button groups, which are PushButtonGroup, RadioButtonGroup and ToolButtonGroup.
Button groups are GUI elements to group buttons together, because they share a common purpose. An example would be a panel where the user has to select one or more filters to be applied to an image. The buttons would be checkable and not exclusive. The button group can be synchronized with an enum field, integer field, and it can be used without any field.
CommonButtonGroup [FIELD] {
border = BOOL [No]
exclusiveButtons = BOOL [No, with fields Yes]
margin = UINT [2]
orientation = ENUM [Horizontal]
showButtonNames = BOOL [No]
showIconsOnly = BOOL [No]
spacing = UINT [4]
stripEnumItemPrefix = BOOL [Yes]
strips = UINT [1]
title = TRANSLATEDSTRING
items {
item [NAME|VALUE] {
command = SCRIPT
enabled = BOOL
visible = BOOL
dependsOn = FIELDEXPRESSION
visibleOn = FIELDEXPRESSION
image = IMAGEFILE
shortcut = TRANSLATEDKEYSEQUENCE
title = TRANSLATEDSTRING
tooltip = TRANSLATEDSTRING
whatsThis = TRANSLATEDSTRING
activeOnImage = IMAGEFILE
activeOffImage = IMAGEFILE
disabledOnImage = IMAGEFILE
disabledOffImage = IMAGEFILE
normalOnImage = IMAGEFILE
normalOffImage = IMAGEFILE
}
// ... more items may follow ...
}
}
border = BOOL (default: No)sets whether a rectangular border is drawn around the buttons.
![]() | Note |
|---|---|
A border is required if a title is given. Setting border to No and specifying a title will result in an error message and border will be set to Yes. |
exclusiveButtons = BOOL (default: No, with field: Yes)sets whether only the last clicked buttons is checked and all others are released. This is only supported if buttons are checkable.
![]() | Note |
|---|---|
If an enum field or integer field is used, then this is always Yes, because the field can have only one state. |
margin = UINT (default: 2)sets the margin of the button group widget. It is applied to all four sides: top, left, bottom, right.
orientation = ENUM (default: Horizontal)specifies if the buttons are vertically or horizontally laid out.
showButtonNames = BOOL (default: No)sets whether the button name is appended to the title.
showIconsOnly = BOOL (default: No)sets whether the button name and title are not displayed.
spacing = UINT (default: 4)sets the amount of space between the buttons.
stripEnumItemPrefix = BOOL (default: Yes)sets whether title prefixes are removed. For example, if the enum titles are "AutoUpdate" and "AutoLoad", the titles will be "Update" and "Load". "Auto_Update" and "Auto_Load" will also be "Update" and "Load". This is only evaluated if the button group is assigned to an enum field.
strips = UINT (default: 1)specifies how many buttons are added to a row if the orientation is horizontal, or to a column if the orientation is vertical.
title = STRINGspecifies the title of the button group. If it is not empty, border must be set to Yes, since it this required. Otherwise a warning is printed.
itemsspecifies the items of an enumeration. Their values must correspond to a field value, or, if no field is given, it can be freely choosen. The value will be the button name and is used to access the buttons through the scripting API (see Button Access Slots in MLABCommonButtonGroupControl).
command = SCRIPTdefines a script command that is called when the button has been clicked.
enabled, visible = BOOLsets whether the button is initially enabled/visible.
dependsOn, visibleOn = FIELDEXPRESSIONdetermines whether the button is disabled/hidden, otherwise enabled/visible. See dependsOn/ visibleOn of the generic Control for a more detailed explanation of the expression.
image = IMAGEsepcifies an image file to add an icon to the button.
title = STRINGspecifies the text of the button.
tooltip = STRINGsets a text that pops up if the button receives a tooltip event. For example, this happens when the mouse cursor stays over the button.
whatsThis = STRINGsets an additional help text.
activeOnImage, activeOffImage, disabledOnImage, disabledOffImage, normalOnImage, normalOffImage = IMAGEFILEspecifies image files that are displayed as the icon of the button, depending on its modes and states.
The button is active when the user is interacting with the button, for example, moving the mouse over it or clicking it.
disabled means that the functionality of the button is not available.
normal is the default mode. The user is not interacting with the button, but the functionality is available.
The on and off states correspond to the ckecked state of the button.
Dynamic scripting: MLABCommonButtonGroupControl
PushButtonGroup is derived from CommonButtonGroup.
PushButtonGroup supports these additional tags:
PushButtonGroup [FIELD] {
autoScaleIcons = BOOL [No]
checkableButtons = BOOL [No, with field Yes]
flatButtons = BOOL [No]
// .. more tags of CommonButtonGroup ...
}
autoScaleIcons = BOOL (default: No)sets whether the icons are scaled to the default icon size of MeVisLab.
checkableButtons = BOOL (default: No, with field: Yes)sets whether the buttons are checkable and are automatically raised after clicking on them.
![]() | Note |
|---|---|
If an enum field or integer field is used, then this is always Yes, because the field has a state. |
flatButtons = BOOL (default: No)sets whether the border of the button is not raised.
Dynamic scripting: MLABPushButtonGroupControl
RadioButtonGroup is derived from CommonButtonGroup.
![]() | Note |
|---|---|
The radio buttons are always checkable and the default value for exclusiveButtons is Yes. |
RadioButtonGroup [FIELD] {
// .. tags of CommonButtonGroup ...
}
Dynamic scripting: MLABRadioButtonGroupControl
ToolButtonGroup is derived from CommonButtonGroup.
ToolButtonGroup supports these additional tags:
ToolButtonGroup [FIELD] {
autoScaleIcons = BOOL [No]
autoRaiseButtons = BOOL [Yes]
checkableButtons = BOOL [No, with field Yes]
// .. more tags of CommonButtonGroup ...
}
autoScaleIcons = BOOL (default: No)see autoScaleIcons of PushButtonGroup.
autoRaiseButtons = BOOL (default: Yes)sets whether tool buttons are automatically raised.
checkableButtons = BOOL (default: No, with field: Yes)see checkableButtons of PushButtonGroup.
Dynamic scripting: MLABToolButtonGroupControl
![]() | Note |
|---|---|
This control is deprecated. Use PushButtonGroup, RadioButtonGroup, ToolButtonGroup or ComboBox instead. |
ButtonBar is a control that has different appearances for a given number of entries being read from an enum field or integer field. It can be vertically or horizontally laid out. It is synchronized with the field bidirectionally.
Available modes are:
a group of Buttons with icons and/or titles
a group of RadioButtons with icons and/or titles
a ComboBox that shows a pop-up bar showing the possible
options as items. Items are given as list of items in the items tag group. Each item either gives an
enum string value or an integer number. If no items are given for an
enum field, all enums are automatically shown with their
titles.
Dynamic scripting: MLABButtonBarControl
ButtonBar FIELD {
title = STRING
show = ENUM [All]
enumAutoFormat = BOOL [Yes]
direction = ENUM [Horizontal]
border = BOOL [Yes]
showItemInternals = BOOL [No]
strips = INT [1]
autoScale = BOOL [No]
items {
item [NAME|VALUE] {
image = FILE
title = STRING
tooltip = STRING
whatsThis = STRING
accel = KEYSEQUENCE
normalOnImage = FILE
normalOffImage = FILE
activeOnImage = FILE
activeOffImage = FILE
disabledOnImage = FILE
disabledOffImage = FILE
}
...
}
}show
= ENUM (default: All)how the ButtonBar should show its items.
Possible values: One, All, Radio, Toolbuttons
"one" shows the pop-up menu, "all" shows all entries as buttons, "radio" shows radio buttons and "toolbuttons" shows tool buttons.
direction = ENUM (default:
Horizonal)defines the layout direction of the buttons.
Possible values: Vertical, Horizontal
border = BOOL (default: Yes)sets whether buttons should have a border (not selectable in all show options).
showItemInternals = BOOL (default:
No)sets whether items show their internal name.
title = STRINGsets the title of the ButtonGroup frame if any (if used, implicitly sets border = Yes).
strips = INT (default: 1)sets the number of "strips" in which the buttons are organized.
spacing = INT (default: 4)sets the spacing between buttons (not used in all show options).
autoScale = BOOL (default: No)sets the scaling of the images of toolbuttons to the MeVisLab global default tool button size.
enumAutoFormat = BOOL (default: Yes)sets whether the enumeration item names should be automatically formatted.
itemsspecifies the items shown in the ButtonBar. If not specified, uses items from enum field automatically.
Each item is specified with the item tag which need to have a string value
for an enum field and an integer for an integer field.
Each item entry can hold the following tags:
image = FILEsets the image to be used for the item.
title = STRINGsets the title to be used for the item. To have a toolbutton that only shows its icon, set this explicitly to an empty string.
tooltip = STRINGsets the tool tip shown on the item (for the pushbutton, radiobuttons).
whatsThis = STRINGsets an additional help text for the item (for the pushbutton, radiobuttons).
accel = STRINGsets an accelerator key for this item.
normalOnImage = FILEnormalOffImage = FILEactiveOnImage = FILEactiveOffImage = FILEdisabledOnImage = FILEdisabledOffImage = FILEspecifies images for the different states of the buttons (not supported in all show modes).
// Integer field as radio buttons
ButtonBar someIntField {
show = Radio
direction = Vertical
title = "Select child"
items {
item -1 { title = "Auto" }
item 0 { title = "Child 0" }
item 2 { title = "Child 2" }
item 4 { title = "Child 4" }
}
}
// Enum field as buttons
ButtonBar someEnumField {
show = All
direction = Vertical
items {
item "ADD" { image = $(LOCAL)/add.png [title= ...]}
item "SUBTRACT" { image = $(LOCAL)/subtract.png }
item "BLEND" { image = $(LOCAL)/blend.png }
}
}CheckBox is a check box with a label or image to the right. It can be synchronized with an MLABBoolField or MLABIntegerField. If a Field is given, the label of the Checkbox also supports drag-and-drop the same way as Field-Controls.
Dynamic scripting: MLABCheckBoxControl
![]() | Tip |
|---|---|
A CheckBox is used to implement a many-of-many choice, while a one-of-many choice is done with a ButtonBar (especially the radio option) or a ComboBox |
CheckBox [FIELD] {
title = STRING
checked = BOOL [Yes]
image = FILE
editable = BOOL [Yes]
toggledCommand = SCRIPT
}checked
= BOOL (default: Yes)specifies the intially checkbox state.
title
= STRINGsets the label text next to the checkbox (RichText).
image
= FILEspecifies a pixmap to use next to the checkbox.
editable =
BOOL (default: Yes)sets whether an editing is allows of the value. If set to 'No' the value is not editable, but the text is displayed normally.
(This is different from the general Control tag enabled, which enables or disables a
whole control (also called "grayed out").)
toggledCommand = SCRIPT (argument:
toggledState)sets a script command that is called when checkbox is checked or unchecked, passing the new state as argument.
ComboBox is a control that allows a string to be edited and also supports a pop-up of possible values. If editing is disabled, only selecting a preset is possible. For enum fields, you should use a ButtonBar instead. If the ComboBox has a given field, it is synchronized in both directions. The field can be of any type that reacts in a meaningful way with a setStringValue/stringValue.
Dynamic scripting: MLABComboBoxControl
ComboBox [FIELD] {
editable = BOOL [Yes]
autoComplete = BOOL [No]
maxCount = INT
insertPolicy = ENUM [AtBottom]
duplicatesEnabled = BOOL [Yes]
comboField = FIELD
comboSeparator = STRING [,]
activatedCommand = SCRIPT
textChangedCommand = SCRIPT
items {
item {
image = FILE
title = STRING
}
...
}
}editable = BOOL (default: Yes)sets whether the comboxbox string is editable.
autoComplete = BOOL (default: No)sets whether the combobox auto completes when editable.
textChangedCommand = SCRIPT(argument:
string)defines a script command that is executed when the text in the combo box changes (every time the user types something).
activatedCommand = SCRIPT (argument:
string)defines a script command that is executed when a combobox item is selected or entered by typing and pressing return.
maxCount = INTsets the maximum number of items.
insertPolicy = ENUM
(default: AtBottom)defines where new items are inserted when combo box is editable.
Possible values: NoInsertion, AtTop, AtCurrent, AtBottom, AfterCurrent, BeforeCurrent
duplicatesEnabled = BOOL (default: Yes)sets whether duplicate items are allowed to be entered when editable (does not apply to script methods that insert items).
comboField = FIELDspecifies a field whose string value is split and used instead of given items.
When the comboField changes, the available combo list is updated.
comboSeparator = STRING
(default:",")sets a string value to use for splitting the string value of
comboField into individual
values.
itemsspecifies the items shown in the ComboBox. May be omitted if
comboField is given.
Each item is specified with the item tag.
Each item entry can hold the following tags:
Example 4.10. ComboBox
Have a look at the module TestComboBox. This module features a ComboBox and some scripting for adding new items dynamically, as well as clearing all items by scripting. The module also features the use of icons in a ComboBox.
Because the major portion of this example module is implemented in scripting, the code is not printed here.
MenuBar is a control that shows a menu bar with a number of pop-up menus. It can contain n SubMenu entries. See SubMenu for details on the menu definition.
Typically a MenuBar should only be used on the top of a window, but there is no layout restriction on that.
Dynamic scripting: MLABMenuBarControl
MenuBar {
SubMenu NAME {
...
}
// more SubMenus ...
}Example 4.11. MenuBar
Have a look at the module TestPopupMenu. This module shows how to setup various menues on a module's GUI. The first menu created on that module uses a MenuBar with only one entry.
ColorEdit shows a colored box and allows to edit an RGB color. If the user double-clicks on the colored box, a ColorDialog pops up and you can pick a color. The given field has to be of type MLABColorField. The field is synchronized with the ColorEdit in both directions.
Dynamic scripting: MLABColorEditControl
![]() | Tip |
|---|---|
You can also drag colors between color edits. |
ColorEdit FIELD {
mode = ENUM [Box]
}Example 4.12. ColorEdit
Have a look at the module TestVerticalLayout. This module features, amongst others, the use of a ColorEdit.
LineEdit shows a single line with an editable string. Typically it can be edited. If you want a non-editable text, use Label instead. LineEdit typically is synchronized bidirectionally with a given field, but it can also be used in scripting only.
Dynamic scripting: MLABLineEditControl
LineEdit [FIELD] {
value = STRING
textAlignment = ENUM [Left]
minLength = INT [5]
maxLength = INT
hintText = STRING
trim = ENUM [None]
editMode = ENUM [Normal]
returnPressedCommand = SCRIPT
textChangedCommand = SCRIPT
lostFocusCommand = SCRIPT
validator = REGEXP
updateFieldWhileEditing = BOOL [No]
}value
= STRINGsets the value of the line edit if FIELD is omitted.
minLength = INT (default: 5)sets the minimum number of characters that should be visible in the LineEdit.
maxLength = INTsets the maximum allowed length of text.
hintText = STRINGdefines a text shown in editable line edit if line edit is empty and does not have the focus.
updateFieldWhileEditing = BOOL (default: No)sets whether the attached field is updated while the user types text in the line edit.
textAlignment = ENUM (default: Left)defines how the text is aligned.
Possible values: Auto, Left, Right, Center
editMode = ENUM (default: Normal)defines the mode, can be set for use for password editing.
Possible values: Normal, Password
trim =
ENUM (default: None)defines the trimming mode of the string when it is not edited. Trimming only works if there is an attached field.
Possible values: Left, Center, Right, None
Left: "...LongText"
Center: "Long...Text"
Right : "LongText..."
None: No trimming
returnPressedCommand = SCRIPT textChangedCommand = SCRIPTdefines a script command that is called when RETURN is pressed or when the text has changed.
lostFocusCommand = SCRIPTdefines a script command that is called when the focus is lost. Use the isModified method
to check if the text was edited by the user
validator = REGEXPspecifies a regular expression to test if the entries are valid.
Example 4.13. LineEdit
Have a look at the module TestVerticalLayout. This module features, amongst others, the use of a LineEdit.
NumberEdit shows a edit box for integers, floats and doubles. It also has a step up/step down button (if a step value is given). A field has to be given to which the NumberEdit is synchronized bidirectionaly. If the field has a min/max value, the edited value is automatically clamped to these values. If no format is given, floating point precision is 3.
Dynamic scripting: MLABNumberControl
NumberEdit FIELD {
step = FLOAT
stepstep = FLOAT
format = FORMATSTRING
minLength = INT [5]
editAlign = ENUM [Right]
}step
= FLOATdefines a step value for step buttons.
stepstep = FLOATdefines an extra step value for stepping smaller steps.
format = STRINGdefines a format to be printed as in sprintf, e.g., %4.5f or %x .
![]() | Note |
|---|---|
You have to use the correct %d,%x ,%f,%g type for float/double/int fields |
minLength = INT (default: 5)sets the minimum number of characters that should be visible in the LineEdit.
editAlign = ENUM (default: Right)defines the alignment of the text in the Line/NumberEdits.
Possible values: Left, Right, Center
wrap
= BOOLif FIELD has min/max value, this option sets whether step and stepstep wrap the value around when reaching the boundaries.
Example 4.14. NumberEdit
Have a look at the module TestHorizontalLayout. This module features, amongst others, the use of a NumberEdit.
VectorEdit allows showing/editing of a Vec2f/3f/4f/Color/Plane/Rotation field. It has n labels and number edits depending on the type of the field. The VectorEdit is synchronized in both directions. Typical layout: x | NumberEdit | y | NumberEdit | z | NumberEdit | d | NumberEdit | [Apply Button]
The Apply button is only needed for the Rotation field, because the rotation vector is always normalized immediately. The Apply button can be enabled for other fields if needed.
Dynamic scripting: MLABVectorControl
VectorEdit {
edit = BOOL [Yes]
format = STRING
minLength = INT [3]
editAlign = ENUM [Right]
applyButton = BOOL
sunkenVectorLabels = BOOL [Yes]
spacing = INT [0]
}edit
= BOOL (default: YES)sets whether Labels are used instead of NumberEdits.
format = STRINGdefines the format to be printed as in sprintf, e.g., %4.5f or %x .
![]() | Note |
|---|---|
You have to use the correct %d,%x ,%f,%g type for float/double/int fields. |
minLength = INT (default: 3)sets the minimum number of characters that should be visible in the NumberEdits.
editAlign = ENUM (default: Right)defines the alignment of the text in the NumberEdits.
Possible values: Left, Right, Center
applyButton = BOOLsets whether the field has an Applybutton. It is enabled for Rotation fields, otherwise the default is disabled. If turned on, you can edit all fields of a vector and apply it afterwards at once by pressing "Apply".
sunkenVectorLabels = BOOL (default:
Yes)sets whether labels are drawn into the same frame as the LineEdit, otherwise they are drawn separately.
spacing = INT (default: 0)sets the internal spacing between the GUI elements of a VectorEdit.
Example 4.15. VectorEdit
Have a look at the module DRR. This module uses two VectorEdit controls in a Grid layout.
Slider shows a slider control for integers, floats and doubles. It can be arranged vertically or horizontally. A field has to be given to which the Slider is synchronized bidirectionally. Min/max values are taken from the field and will be adjusted automatically when the field's min/max value changes.
Dynamic scripting: MLABSliderControl
Slider FIELD {
pageStep = FLOAT
snap = FLOAT
autoPageStep = FLOAT
direction = ENUM [Horizontal]
format = FORMATSTRING
tickmarks = BOOL [No]
scale = ENUM [Normal]
tracking = BOOL [Yes]
pressedIndicatorField = FIELD
}pageStep = FLOATsets a step value that is used when the user clicks left or right of the slider.
snap =
FLOATsets a snap value for the slider. If set to a value != 0, the slider always snaps to a value that is a multiple of this value starting at the sliders minimum.
pressedIndicatorField = FIELDspecifies a Boolean field that is set to true if the user presses the slider button and to false if the user releases the slider button.
autoPageStep = FLOATsets a step value as percentage 0..1 of min/max value, overwrites
pageStep.
direction = ENUM (default:
Horizontal)defines the layout direction of the slider.
Possible values: Vertical, Horizontal
format
= FORMATSTRINGspecifies the format of the tool tip in sprintf format.
tickmarks = BOOL (default: No)sets whether tick marks are enabled.
scale =
ENUM (default: Normal)defines the scale of the slider.
Possible values: Normal, Log
tracking = BOOL (default: Yes )sets whether the slider updates the field while the slider is being dragged.
Example 4.16. Slider
Have a look at the module TestHorizontalLayout. This module shows the use of various controls for a float number.
IntervalSlider shows a double slider control for integers, floats and doubles. It can be arranged vertically or horizontally. A widthField and centerField pair or a lowerField and upperField pair has to be given to which the Slider is synchronized bidirectionally. Min/Max values are taken from the lower/upper fields or from the center field and will be automatically adjusted when field's min/max value changes.
When width/center is given, the slider acts in window/level mode so that the window can be of (max/min) size. When lower/upper is given, it allows choosing lower and upper values and is bound strictly to min/max values.
Dynamic scripting: MLABIntervalSliderControl
![]() | Tip |
|---|---|
Only width/center or lower/upper field pairs can be given, NOT both! |
IntervalSlider {
step = FLOAT
snap = FLOAT
direction = ENUM [Horizontal]
tracking = BOOL [Yes]
centerField = FIELD
widthField = FIELD
upperField = FIELD
lowerField = FIELD
pressedIndicatorField = FIELD
}step = FLOATsets a step value that is used when the user clicks left or right of the slider.
snap = FLOATsets a snap value. If set to a value != 0, the slider always snaps to a value that is a multiple of this value starting at the sliders minimum.
pressedIndicatorField = FIELDspecifies a Boolean field that is set to true if the user presses the slider button and to false if the user releases the slider button.
direction = ENUM (default:
Horizontal)lspecifies the ayout direction of slider.
Possible values: Vertical, Horizontal
tracking = BOOL (default: Yes )sets whether the slider updates the field while the slider is being dragged.
centerField = FIELDspecifies the center (alias level) field of the interval (min and max values are also taken from this field).
widthField = FIELDspecifies the width (alias window) field of the interval.
lowerField = FIELDspecifies the lower field of the interval (min value is also taken from this field).
upperField = FIELDspecifies the upper field of the interval (max value is also taken from this field).
Example 4.17. IntervalSlider
Have a look at the module View3D. If the window 'View3D' (the default window) is opened, IntervalSliders are used on the 'Clipping' tab for adjusting the size of a subimage.
ThumbWheel shows a wheel that can be turned. When the wheel is turned, it changes the associated Field which can be an Integer, Float, Double or Rotation field. The ThumbWheel adapts to the given min and max value of a field automatically. For Rotation fields (which have not min/max value), it automatically takes 0-359 degrees as min/max values. This can also be used for Float and Double fields by setting rotationMode to Yes. Otherwise the field's min/max values are used.
Dynamic scripting: MLABThumbWheelControl
ThumbWheel FIELD {
snap = FLOAT
tracking = BOOL [Yes]
wrapsAround = BOOL [No]
direction = ENUM [Horizontal]
ratio = FLOAT [1]
rotationMode = BOOL [No]
pressedIndicatorField = FIELD
}snap
= FLOATsets the snap value. The value of the wheel always snaps to a multiple of the snap value. If not set, an automatic value is calculated.
tracking = BOOL (default: Yes)sets whether the wheel updates the field while being dragged
pressedIndicatorField = FIELDspecifies a Boolean field that is set to true if the user presses the slider button and to false if the user releases the slider button.
direction = ENUM (default:
Horizontal)defines the layout direction of slider.
Possible values: Vertical, Horizontal
ratio = FLOAT (default: 1)defines the ratio between turning the wheel one whole turn and the min/max range.
wrapsAround = BOOL (default: No )sets whether the slider wraps around when min/max is reached.
rotationMode = BOOL (default: No
)sets whether the field's min/max values are set to 0/359 degrees (in radian), to allow for an easy setup for rotations.
Example 4.18. ThumbWheel
Have a look at the module DRR. There, ThumbWheels are used for adjusting the beam path rotation around the z- and x-axis.
TextView shows a text (which may be simple text or RichText). It can be editable or just a
display, and is scrollable. It typically shows a title and an Apply
button. If a field is given, the fields string value is shown. If a
field is given, it is synchronized bidirectionally. Typically the user
has to press the "Apply" button to set the text to the field. If
autoApply is on, each change to the text changes the field's string
value. The "Apply" button is only visible if edit is set to 'Yes'.
Dynamic scripting: MLABTextViewControl
TextView [FIELD] {
title = STRING
text = STRING
edit = BOOL [Yes]
autoApply = BOOL [No]
hscroller = ENUM [Auto]
vscroller = ENUM [Auto]
textFormat = ENUM [Auto]
console = BOOL [No]
tabStopWidth = INT [80]
wrap = ENUM [Widget]
wrapColumn = INT [80]
visibleRows = INT
showLineNumbers = BOOL [No]
}title
= STRINGsets a string to show as title (otherwise the title is the name of the field).
text =
STRINGsets a string to show if no field is given.
edit =
BOOL (default: Yes)sets whether the text field is editable. Otherwise it is a display only.
autoApply = BOOL (default: No)sets whether the entered value is applied to the field whenever it changes.
textFormat = ENUM (default: Auto)defines the format of the text. The default is 'Auto' which searches the first text line for <> tags and switches between Rich and Plain. In Rich mode you can use HTML-like syntax for the text.
Possible values: Auto, Rich, Plain
hscroller = ENUM (default: Auto)vscroller = ENUM (default: Auto)defines when a vertical/horizontal scrollbar is shown.
Possible values: Auto, On, Off
console = BOOL (Default: No)sets whether to scroll to the end of the buffer on each append. Otherwise, it is scrolled to the new field value.
tabStopWidth = INT (Default: 80 pixels)
sets the width of a tab stop in pixels.
wrap =
ENUM (Default: Widget)defines the wrap mode of the TextView. The default "Widget" wraps at word boundaries inside the visible portion of the widget. "Off" switches off wrapping, "Column" wraps at a column specified by wrapColumn.
Possible values: Widget, Column, Off
wrapColumn = INT (Default: 80)sets the column where to wrap words if wrap is set to "Column".
visibleRows = INTsets the minimum size of the TextView to hold at least n visible rows.
showLineNumbers = BOOL (default: No)sets whether line numbers are shown. Only filled lines are numbered if enabled. Numbering starts with 1.
HyperText shows a RichText which can be any size and which is scrollable when bigger than the available space. In contrast to TextView, the text is always read-only. The text can contain hyper links of various kinds, which can also have a tool tip on them. The shown text can be specified directly in the text tag, from a text file or from a field. If a field is used, the text is updated whenever the field changes.
Dynamic scripting: MLABHyperTextControl
Example of hyper links:
<a href="http://www.mevis.de">Mevis Home
Page</a>
<a href="mailto:MeVisLab@mevis.de">MeVisLab
Mail</a>
<a href="#someanchor">Link inside this
document</a>
<a name="someanchor">Link anchor inside this
document</a>
<a name="tooltip:Some tooltip" href=...>A link
with additional tooltip</a>
<a href="usercmd:somecommand">A call to the
command script with "somecommand" as
argument</a>
<a href="js: MLAB.log('hello')">A link that
directly executes JavaScript</a>
<a href="whatsthis:Some RichText">A link that
shows a WhatsThis bubble that contains
RichText</a>
For details, see the example module TestHyperText.
HyperText is derived from Frame.
HyperText {
text = RICHTEXT
textField = FIELD
textFile = FILE
command = SCRIPT
// Additional: tags from Frame
}text
= RICHTEXTsets the text that is shown. If you want to reference local files or images, use the $(LOCAL)/ variable to address these.
textField = FIELDspecifies a field that provides the text. The text is updated whenever the field changes.
textFile = FILEspecifies a file that provides the text. Local links in the text are resolved local to that file, so you can link to other documents and images.
command = SCRIPT (arg: string)defines a script command that is called for each "usercmd:" hyper link when the link is clicked. The string after the "usercmd:" is passed to the command.
This tag allows to create dynamic scripts that are executed when a link is clicked. All clicks are mapped to the given command, in which you can do different things depending on the argument after the "usercmd:"
Example 4.19. HyperText
Have a look at the module TestHyperText. This module features a HyperText and documents some of the available options.
HyperLabel is identical to HyperText in its features, but shows the text as a label. Therefore it is not scrollable and automatically gets as big as the contained text. It behaves like a normal label but has the features of dynamic scripted links. Another advantage over a normal label is that the text can be selected and copied. For details see the HyperText control above. Note that title, titleField and titleFile are aliases for text, textField and textFile of HyperText. If the displayed text should be arranged in one line, it has to be enclosed in "<nobr></nobr>".
HyperLabel is derived from Frame.
Dynamic scripting: MLABHyperLabelControl
HyperLabel {
title = RICHTEXT
titleField = FIELD
titleFile = FILE
command = SCRIPT
// Additional: tags from Frame
}title = RICHTEXTsets the text that is shown. If you want to reference local files or images, use the $(LOCAL)/ variable to address these.
titleField = FIELDspecifies a field that provides the text. The text is updated whenever the field changes.
titleFile = FILEspecifies a file to provide the text. Local links in the text are resolved local to that file, so you can link to other documents and images.
Example 4.20. HyperLabel
Have a look at the module TestHyperText. This module features a HyperLabel at the very top of its GUI.
ListBox shows a list of single line items. The list can be set
by scripting or from fields providing the items via splitting the
string. The ListBox takes the string value of the values tag or of the given field and creates
items out of these strings. If a field is given, the list box is updated on
the field's string value changes. Scripting methods can be found in
the MeVisLab Scripting reference.
Dynamic scripting: MLABListBoxControl
ListBox [FIELD] {
values = STRING
visibleRows = INT
selectionMode = ENUM [Single]
rowSeparator = STRING [@]
selectionChangedCommand = SCRIPT
selectedCommand = SCRIPT
currentChangedCommand = SCRIPT
doubleClickedCommand = SCRIPT
returnPressedCommand = SCRIPT
contextMenuOnEmptyList = BOOL [Yes]
contextMenu {
// See definition of SubMenu
}
}values = STRINGsets a string that is used for the values instead of the FIELD.
rowSeparator = STRING (default "@")sets a separator string used for columns.
visibleRows = INTsets a minimum height to show at least number of visible rows.
selectionMode = ENUM (default:
Single)defines if selection is possible and if multiple items can be selected at a time.
Possible values: Single, Extended, Multi, NoSelection
contextMenudefines a context menu to show on right-click the list. See SubMenu on how to define a menu.
contextMenuOnEmptyList = BOOL (default: Yes)sets whether the context menu should be shown on an empty list.
selectionChangedCommand = SCRIPTdefines a script command that is called when the selection has changed.
selectedCommand = SCRIPT (argument:
index)defines a script command that is called when an item is selected (return is pressed or double-click the item).
currentChangedCommand = SCRIPT (argument:
index)defines a script command that is called when the current item has changed.
doubleClickedCommand = SCRIPT (argument:
index)defines a script command that is called when an item is double-clicked.
returnPressedCommand = SCRIPT (argument:
index)defines a script command that is called when return is pressed on an item.
Example 4.21. ListBox
Have a look at the module TestListBox. This module features a dynamic setting and clearing of items, and it shows how to display items with icons.
ListView shows a list containing strings in rows/columns. The
list can be set by scripting or from fields providing the items via
splitting the string. The ListView takes the string value of the
values tag or of the given field and
creates items out of these strings. If a field is given, updates
everything (even number of columns) from the field's string value
changes. The first row in the string is taken as Header titles,
further rows can contain less columns. The header titles have to be
present even if the header visibility is turned off.
Limitations: Currently CheckBox items cannot contain RichText
(see richText tag).
Dynamic scripting: MLABListViewControl and MLABScriptListViewItem
ListView [FIELD] {
values = STRING
rowSeparator = STRING [\n]
columnSeparator = STRING [@]
layout = STRING
visibleRows = INT
cellSpacing = INT
selectionMode = ENUM [Single]
sortByColumn = INT [-1]
sortAscending = BOOL [Yes]
header = BOOL [Yes]
// advanced:
richText = BOOL [No]
toggleField = FIELD
checkList = BOOL [No]
updateDelay = UINT [0]
rootIsDecorated = BOOL [No]
contextMenuOnEmptyList = BOOL [Yes]
contextMenu {
// See definition of SubMenu
}
// scripting:
selectionChangedCommand = SCRIPT
currentChangedCommand = SCRIPT
doubleClickedCommand = SCRIPT
returnPressedCommand = SCRIPT
clickedCommand = SCRIPT
// advanced scripting
itemRenamedCommand = SCRIPT
itemCollapsedCommand = SCRIPT
itemExpandedCommand = SCRIPT
checkListItemChangedCommand = SCRIPT
prepareEditCommand = SCRIPT
}values = STRINGsets a string that is used for the values instead of the FIELD.
rowSeparator = STRING (default "\n")sets a separator string that is used for rows.
columnSeparator = STRING (default
"@")sets a separator string that is used for columns.
layout = STRINGsets a string that defines the layout of the columns "rlcet, rlcet, ..." (right left center edit toggle).
rlc - results in different alignment (right,
left, center).
e - column is editable.
t - one of the columns may have the "t"
toggle flag which means that a CheckBoxListItem is used and the
toggleField updates checkbox states.
visibleRows = INTspecifies a minimum size to fit number of visible rows (+ header) into the ListView.
cellSpacing = INTsets an extra spacing value to all items.
selectionMode = ENUM (default:
Single)defines if selection is possible and if multiple items can be selected at a time.
Possible values: Single, Extended, Multi, NoSelection
sortByColumn = INT (default: -1)sets the column number which is to sort by (default -1 means no sorting).
sortAscending = BOOL (default: Yes)sets whether the sorting should be in an ascending order.
header = BOOL (default: Yes)selects whether the header row is visible. If set to 'No', the header is not shown, while the titles still have to be provided via values or FIELD.
richText = BOOL (Default: No)sets whether the items in the list are used as RichText, allowing to change font type, size, colors, etc.
See Section 4.9.2, “RichText” for details on RichText.
toggleField = FIELDspecifies a field to set the toggle state encoded in 0/1 chars (field is updated/updates in both directions).
checkList = BOOL (default: No)sets whether the ListView uses CheckListItems. Normally this flag is not used; the ListView is a ToggleList if a toggleField is specified.
updateDelay = UINT (default: 0)sets the delay in milliseconds of the ListView update when the given FIELD is changed. If set to zero the update is immediate. This flag can be useful when the ListView is updated very often due to user interaction since it is slow to update. If you set e.g., a value of 100, the ListView will only update 10 times a second.
rootIsDecorated = BOOL (default:
No)sets whether icons are shown if a node (item) is collapsed or expanded.
contextMenudefines a context menu to show on right-click the list. See SubMenu on how to define a menu.
contextMenuOnEmptyList = BOOL (default: Yes)sets whether the user's contextMenu is shown if the list has no entries.
selectionChangedCommand = SCRIPTdefines a script command that is called when the selection has changed. If you want to get
the selected item, call selectedItem() on
the ListView.
currentChangedCommand = SCRIPT (argument:
item)defines a script command that is called when the current item has changed.
doubleClickedCommand = SCRIPT (argument:
item)defines a script command that is called when an item is double-clicked.
returnPressedCommand = SCRIPT (argument:
item)defines a script command that is called when an item is renamed.
clickedCommand = SCRIPT (arguments: item,
column)defines a script command that is called when an item is clicked (press+release of mouse button), column gives into which column the user clicked.
mouseButtonClickedCommand =
SCRIPT(arguments: button, item, position, column)this command is like clickedCommand, but provides more information. "button" is a number: 0 is the left mouse button and 1 is the right mouse button. "position" indicates the global mouse position, i.e., it is not relative to the list view.
itemRenamedCommand = SCRIPT (argument:
item, column, newvalue)defines a script command that is called when an item is renamed.
itemCollapsedCommand = SCRIPT (argument:
item)defines a script command that is called when an item with children is collapsed.
itemExpandedCommand = SCRIPT (argument:
item)defines a script command that is called when an item with children is expanded.
checkListItemChangedCommand = SCRIPT
(argument: item, column)defines a script command that is called when a check list item is toggled. The column parameter is important if you have created check boxes on other columns than the first with item.setCheckBoxOn().
prepareEditCommand = SCRIPT (argument:
item, column)defines is script command that is called when a cell in the list view is about to be edited. This is mainly intended for use with the method setStringEditorValues() on the list view control which allows one to provide a combo box instead of a simple line edit widget for editing of cells with string content.
Example 4.22. ListView
Have a look at the module TestListView. This module features the dynamic creation and removal of different list items.
IconView shows a grid of icons with text. The items can be set by using the dynamic scripting API.
Dynamic scripting: MLABIconViewControl
IconView {
allowRenaming = BOOL [No]
autoArrange = BOOL [No]
wordWrap = BOOL [No]
maxTextLength = INT [255]
maxItemWidth = INT
selectionMode = ENUM [Single]
arrangement = ENUM [LeftToRight]
resizeMode = ENUM [Fixed]
itemTextPos = ENUM [Bottom]
spacing = INT
selectionChangedCommand = SCRIPT
currentChangedCommand = SCRIPT
selectedCommand = SCRIPT
doubleClickedCommand = SCRIPT
returnPressedCommand = SCRIPT
itemRenamedCommand = SCRIPT
contextMenuOnEmptyList = BOOL [Yes]
contextMenu {
// See definition of SubMenu
}
}allowRenaming = BOOL (default: No)sets whether in-place renaming of items is allowed.
autoArrange = BOOL (default: No)sets whether items should be arranged anew when new items are inserted.
resizeMode = ENUM (default: Fixed)sets whether the items should be arranged when the view is resized.
Possible values: Fixed, Adjust
wordWrap = BOOL (default: No)sets whether words are wrapped in the text.
maxTextLength = INT (default: 255)sets the maximum number of displayed chars.
maxItemWidth = INTsets the maximum width an item can have.
selectionMode = ENUM (default:
Single)defines if selection is possible and if multiple items can be selected at a time.
Possible values: Single, Extended, Multi, NoSelection
arrangement = ENUM (default:
LeftToRight)defines how items are arranged.
Possible values: LeftToRight, TopToBottom
itemTextPos = ENUM (default: Bottom)sets the position of the text.
Possible values: Right, Bottom
spacing = INTdefines the spacing between items.
contextMenudefine a context menu to show on right-click the list. See SubMenu on how to define a menu.
contextMenuOnEmptyList = BOOL (default: Yes)sets whether the user's contextMenu should be shown if the list has no entries.
selectionChangedCommand = SCRIPTdefines a script command that is called when the selection has changed. If you want to get
the selected item, call selectedItem() on
the iconview.
selectedCommand = SCRIPT (argument:
index)defines a script command that is called when a single item is selected (in Single selection mode).
currentChangedCommand = SCRIPT (argument:
index)defines a script command that is called when the current item has changed.
doubleClickedCommand = SCRIPT (argument:
index)defines a script command that is called when an item is double-clicked.
returnPressedCommand = SCRIPT (argument:
index)defines a script command that is called when an item is renamed.
itemRenamedCommand = SCRIPT (argument:
index, newvalue)defines a script command that is called when an item is renamed.
Example 4.23. IconView
Have a look at the module TestIconView. This module features the dynamic adding and removing of icon items, as well as a scripting example on how to react on clicking an icon.
Label shows a RichText label which can be multiline. The label content can be given as a text or by the string value of a field.
Label is derived from Frame.
Dynamic scripting: MLABLabelControl
Label STRING {
title = STRING
titleField = FIELD
image = FILE
indent = INT
buddy = NAME
textAlignment = ENUM
textWrap = ENUM
textFormat = ENUM [Auto]
trim = ENUM [None]
expandTabs = BOOL
selectable = BOOL [No]
allowLinks = BOOL [No]
linkActivatedCommand = SCRIPT
linkHoveredCommand = SCRIPT
// Additional: tags for Frame
}title =
STRINGsets the text of the label.
titleField = FIELDspecifies a field that provides the text for the label (text is updated when field changes).
image =
FILEspecifies a pixmap that is shown on the label.
indent
= INTsets the number of pixels to indent the text.
buddy =
NAMEsets the name of another control that is used as "buddy" of the label which gets the input focus when the label gets the focus (e.g., by pressing an ALT key). Use the & char to set a keyboard shortcut.
textAlignment = ENUMdefines the alignment of the text in the label.
Possible values: Auto, TopLeft, Top, TopCenter, TopRight, Left, Center, Right, BottomLeft, Bottom, BottomCenter, BottomRight
textWrap = ENUMdefines how the text in the label is wrapped.
Possible values: SingleLine, WordBreak
textFormat = ENUM (default: Auto)defines the text format. The default is Auto, which searches the first text line for <> tags and switches between Rich and Plain. For keyboard shortcuts, write a & char in the plain text (&& means a literal &). In Rich mode you can use html-like syntax for the label.
Possible values: Auto, Rich, Plain
trim =
ENUM (default: None)trims the string.
Possible values: Left, Center, Right, None
Left: "...LongText"
Center: "Long...Text"
Right : "LongText..."
None: No trimming
expandTabs = BOOLsets whether tab chars should be expanded to the next tab stop.
selectable = BOOL (default: No)
sets whether the selection of text is allowed with the mouse.
allowLinks = BOOL (default: No)
sets whether clicking on hyper links is allowed. It also enables linkHoveredCommand and linkActivatedCommand. If the linkActivatedCommand is not set, the links are opened via the external program given in MeVisLab preferences.
linkHoveredCommand = SCRIPT (arguments: String)
defines a command that is called when the user hovers over a link and allowLinks is set to true.
linkActivatedCommand = SCRIPT (arguments: String)
defines a command that is called when the user clicks on a link and allowLinks is set to true.
Control that shows an image. The image can be automatically resized to fit the available space.
Image is derived from Frame.
Dynamic scripting: MLABImageControl
Image {
image = FILE
scaleFactor = FLOAT [1.0]
autoResize = BOOL [No]
// Additional: tags for Frame
}Separator is a visual separator (like <HR> in html). It
has a direction and a frame style. Depending on the direction,
expandX and expandY are automatically set to
expanding.
Separator is derived from Frame.
Dynamic scripting: MLABSeparatorControl
Separator {
direction = ENUM [Horizontal]
// Additional: tags for Frame
}Empty is a control which represents empty space. Depending on its size policy, it will extend or be of fixed size. Its tags are derived from the basic control, typically one only uses the given tag.
There are four aliases that have useful presets in vertical and horizontal direction:
VSpacer, SpacerX - control that fills the space
vertically by expanding (when you have a control with a stretch
factor, you might want to change the stretch factor as well).
HSpacer, SpacerY - control that fills the space
horizontally by expanding (when you have a control with a stretch
factor, you might want to change the stretch factor as well).
Empty is derived from Control.
Empty {
expandX = ENUM
expandY = ENUM
stretchX = INT
stretchY = INT
w = INT
h = INT
}ProgressBar shows the current status as a bar between 0% and 100%. The status is controlled by a FloatField which should yield values from 0 to 1.0. The field needs priority 0 to cause an update of the progress immediately, otherwise the update is not guaranteed.
ProgressBar is derived from Frame.
Dynamic scripting: MLABProgressBarControl
ProgressBar FIELD {
textVisible = BOOL [Yes]
// Additional: tags for frame
}Example 4.24. ProgressBar
Have a look at the module WEMIsoSurface. On this module, a ProgressBar is used to display the progress of scanning the slices of the input image.
Menus can be created at various GUI controls, e.g., as a context menu. All these menus start at the level of a SubMenu as given in the following section.
Example 4.25. PopupMenu, SubMenu and MenuItem
For the use of the controls PopupMenu, SubMenu and MenuItem, have a look at the module TestPopupMenu.
A PopupMenu defines a menu that can be popped up via scripting. It is derived from the SubMenu control and is not visible by default. It should be given a name and then be shown via the popup() method. It pops up at the cursor position or at a screen point given by the caller.
Dynamic scripting: MLABPopupMenuControl
PopupMenu {
name = NAME
showCommand = SCRIPT
hideCommand = SCRIPT
// possible children:
Separator = ""
SubMenu = NAME { ... }
MenuItem = NAME { ... }
// advanced children:
Action = NAME
}name
= NAMEsets the internal name used in scripting (like Control name/instanceName).
showCommand = SCRIPThideCommand = SCRIPTdefines script commands that are called when SubMenu is shown/hidden.
A SubMenu can contain multiple MenuItems, SubMenus, Separators and Actions. When an item is selected, a script command is called on the item. An ALT keyboard shortcut can be assigned with the "&" character.
Actions are an advanced concept and are currently only supported for the internal MeVisLab menus.
Dynamic scripting: MLABPopupMenuControl
SubMenu STRING {
name = NAME
showCommand = SCRIPT
hideCommand = SCRIPT
itemActivatedCommend = SCRIPT
// possible children:
Separator = ""
SubMenu = NAME { ... }
MenuItem = NAME { ... }
// advanced children:
Action = NAME
}name =
NAMEsets the internal name used in scripting (like Control name/instanceName).
showCommand = SCRIPThideCommand = SCRIPTdefines script commands that are called when SubMenu is shown/hidden.
itemActivatedCommand = SCRIPTdefines a script command that is called when a direct child of the SubMenu is activated.
MenuItems can be declared inside of a SubMenu or a tag used as
a submenu (e.g., contextMenu,
menuBar).
Dynamic scripting: MLABPopupMenuControl, using the name of the menu item.
MenuItem STRING {
command = SCRIPT
name = NAME
field = NAME
enabled = BOOL [Yes]
dependsOn = FIELDEXPRESSION
checked = BOOL [No]
icon = FILE
accel = KEYSEQUENCE
whatsThis = STRING
// advanced:
slot = QTSLOT
receiver = NAME
}command = SCRIPT (arguments: name)defines a script command that is called when the item is selected.
name
= NAMEsets a name for this item that can be used in the interface of the SubMenu to talk to the item via scripting.
field = NAMEsets an existing field which can be of type bool or trigger. If this is used, selecting this menu item either toggles the Boolean value or notifies the trigger field.
accel = KEYSEQUENCEsets an additional accelerator key sequence.
enabled = BOOL (default: Yes)sets whether the item is enabled (or disabled/grayed out otherwise).
dependsOn = FIELDEXPRESSIONsets whether the menu item is enabled depending on the given field expression. Have a look at the example of this tag for a more detailed explanation.
whatsThis = STRINGsets an additional explanation text.
icon
= FILEspecifies an additional icon that is shown.
checked = BOOL(default: No)sets the initial state for toggle items.
slot
= QTSLOTspecifies a Qt slot instead of a script command (used for MeVisLab internal menus). This is an advanced feature.
receiver = NAMEspecifes the name of an Qt receiver object (used for MeVisLab internal menus). This is an advanced feature.
Panel is a control that can "clone" a subregion of a given
module's windows. If panel and
panelByGroupTitle are not specified,
the control shows the window of a module given by its name. If the
window is not specified, the whole default window is shown.
This also clones all FieldListeners contained in the cloned
code, so that a cloned panel should work like the original one. The
window you get when you call window() in the
context of the cloned script will be the window in which the Panel
is.
Note that no field connections can be established between fields
that are shown on a macro's GUI because of a panel declaration. In order to be able to
establish a field connection to such a field, you need to declare the
according field in the macro module's interface section.
Panel is derived from Control.
Dynamic scripting: MLABPanelControl
Panel {
module = NAME
panel = NAME
window = NAME
// tags that should not be used any more in new panels:
panelByGroupTitle = NAME
}module
= NAME (required)sets the name of the module in the network.
panel =
NAMEsets a name to search for in the given module by looking for a
panelName tag with the name
NAME.
window
= NAMEsets the name of the window to clone.
panelByGroupTitle = NAME
(deprecated!)sets a name to search for by comparing NAME with the values of all group tags in the module's window.
Example 4.26. Panel
Have a look at the module View3D. As explained in the Window example, the View3D module defines
four different windows. The first window (named 'View3D') defines a
viewer and a settings panel. The latter has its panelName set to 'Settings'. The third
window of the module (named 'Settings') just cuts out the settings
part of the first window by using the Panel tag.
DynamicFrame shows a user-defined MDL script file or dynamically generated string. Its contents can be changed interactively from Python or JavaScript. This gives the user the power to create and update dynamically user interfaces in an application, without the need to specify the complete GUI when the application script is started.
The controls in the content of the frame (named with the
name tag) are visible in the global
scope of the window.
You can use the Python or JavaScript methods
setContentFile(string) or
setContentString(string).
Dynamic scripting: MLABDynamicFrameControl
![]() | Tip |
|---|---|
If you dynamically add modules to your application network, you can use this control to clone a panel of the new module or to show fields of the new module on the fly. |
DynamicFrame {
autoSize = BOOL [Yes]
contentFile = FILE
}Viewer shows an OpenInventor viewer. Typically the Inventor
viewer is taken from a SoViewerNode module in the network, especially
SoExaminerViewer, SoRenderArea, etc. A viewer has to be attached to a
SoNode field, typically the "self" field of an InventorModule. If you
specify a type, the viewer is
generated independent from any viewer node in the network.
Dynamic scripting: MLABInventorViewerControl
![]() | Tip |
|---|---|
If you want to access the internal Inventor viewer, you should use the viewer together with a SoExaminerViewer or a SoRenderArea on a network and use the 'self' field of that module for the viewer. |
Viewer FIELD {
viewing = BOOL [Yes]
backgroundColor = COLOR
type = NAME
clone = BOOL [No]
border = BOOL [Yes]
delay = BOOL [Yes]
values = STRING
popup = BOOL [No]
popupMenu {
// see tags for SubMenu
}
}viewing = BOOL (default: Yes)sets whether the viewer is in viewing mode.
popup (default: No) =
BOOLsets whether the viewer has a pop-up menu.
backgroundColor = COLORspecifies the background color of the viewer.
type =
NAMEsets the type of the viewer if the SoNodeField is not from a SoViewerNode module.
Possible values: SoExaminerViewer, SoRenderArea, etc.
clone =
BOOL (default: No)sets whether the viewer shoud be cloned (this is automatically done when two viewers are show from the same module in the network).
border (default: Yes)
= BOOLsets whether the viewer has a border.
delay =
BOOL (default: Yes)sets whether the viewer is created in delayed mode. That means that its content is rendered AFTER the window is drawn the first time, to avoid waiting for the drawing of the rest of the GUI.
values
= STRINGsets the field values of the viewer in Inventor style (you need to know what you are doing and which fields are available).
popupMenudefines a menu that is shown when the user clicks the right mouse button on the viewer. The internal pop-up menu of the viewer (from OpenInventor) has to be turned off, otherwise this menu will not be shown. See SubMenu for details on how to define a menu.
PathBrowser displays a directory tree for browsing. Clicking a directory will open and show its subdirectories. Double-clicking a directory selects a directory. Typically this is used together with the DicomBrowser.
Pressing "r" on a PathBrowser always resets the current path to the original root path.
PathBrowser is derived from Control.
Dynamic scripting: MLABPathBrowserControl
PathBrowser {
root = PATH
visibleRows = INT
minLength = INT
sortBy = STRING [Name]
cd = STRING
pathSelectedCommand = SCRIPT
pathDblClickedCommand = SCRIPT
}root = PATHspecifies the root path of the PathBrowser. If not given or if PATH does not exist or is not readable, the current working directory is used.
visibleRows = INTsets the minimum number of visible rows (defining the minimum height).
minLength = INTsets the minimum width to show INT characters.
sortBy = ENUM (default: Name)specifies the sorting order of directories.
Possible values: Name, Size, Time, Unsorted
cd =
PATHspecifies the relative path from root
to the initially opened subdirectory.
pathSelectedCommand = SCRIPT (argument:
absolute path)pathDblClickedCommand = SCRIPT (argument:
absolute path)defines a script command that is called when the path is selected/double-clicked with left mouse button.
The DicomBrowser displays a configurable tree view on a set of Dicom files. The data is arranged according to the Dicom hierarchy of the files. The DicomBrowser allows copying, moving and linking (only on Unix, yet) of Dicom data by dragging between DicomBrowsers. Dropping an entry from a DicomBrowser to a PathBrowser sets the Path of the PathBrowser to the directory of the dropped entry. Deleting selected datasets is also supported by pressing DEL.
A DicomBrowserTable that is connected to a DicomBrowser always shows a table view of the dataset currently selected in the DicomBrowser. The DicomBrowser and the DicomBrowserTable are synchronized in both directions. Double-clicking a dataset selects it for opening by other controls.
Pressing "r" on these controls reloads the currently viewed datasets, thus allowing the DicomBrowser to be synchronized with external modified directories.
DicomBrowser and DicomBrowserTable are derived from Control.
Dynamic scripting: MLABDicomBrowserControl and MLABDicomBrowserTableControl
DicomBrowser {
name = STRING
visibleRows = INT
minLength = INT
project = STRING
hierarchy = STRING [first one available]
rootDir = STRING
treeRootTitle = STRING
fileExtension = STRING [dcm]
includeFilter = STRING
excludeFilter = STRING
recursive = BOOL [Yes]
showDicomFiles = BOOL [Yes]
selectedCommand = SCRIPT
deletionRequestedCommand = SCRIPT
dblClickedCommand = SCRIPT
}DicomBrowserTable {
name = STRING
visibleRows = INT
minLength = INT
contextMenuOnEmptyList = BOOL
contextMenu {
// See definition of SubMenu
}
}
Execute = "*js: ctx.control("myDicomBrowser").setTableView(ctx.control("myDicomBrowserTable")); *"visibleRows = INTsets the minimum number of visible rows (defining the minimum height).
minLength = INTsets the minimum width to show INT characters.
project = STRINGspecifies the name of a DicomProject with presets for the DicomBrowser.
hierarchy = STRINGspecifies the name of a Dicom hierarchy which is displayed by the DicomBrowser.
rootDir = PATHspecifies the path to DicomFiles. Setting a PathBrowser overwrites this value.
treeRootTitle = STRINGsets the title of the tree view root node which is empty by default.
fileExtension = STRINGsets the filter of the file search to files with this extension.
includeFilter = STRINGsets a filter string to include files in the search.
excludeFilter = STRINGsets a filter to exclude files from the search.
recursive = BOOLsets whether files are searched recursively.
showDicomFiles = BOOL (default: Yes)sets whether the leaves of a Dicom hierarchy in the Browser are shown.
contextMenudefines a context menu to show on right-click the list. See SubMenu on how to define a menu.
contextMenuOnEmptyList = BOOL (default: Yes)sets whether the user's contextMenu is shown if the list has no entries.
selectedCommand = SCRIPT
(argument: absolute path of dataset)defines a script command that is called when a dataset is selected.
deletionRequestedCommand =
SCRIPT (argument: absolute path of dataset)defines a script command that is called when a dataset should be deleted.
dblClickedCommand = SCRIPT
(argument: absolute path of dataset)defines a script command that is called when a dataset is double-clicked.
The MoviePlayer allows to play AVI movies. The movie can be given as a filename and the control can be controlled interactively by Python or JavaScript.
MoviePlayer is derived from Control.
Dynamic scripting: MLABMoviePlayerControl
MoviePlayer {
filename = FILE
autoStart = BOOL [No]
enableContextMenu = BOOL [Yes]
showControls = BOOL [Yes]
}filename = FILEspecifies the filename of the movie (should be an AVI).
autoStart = BOOL (default: No)sets whether the movie should start immediately.
enableContextMenu = BOOL (default:
Yes)sets whether a context menu with advanced control functions is enabled.
showControls = BOOL (default: Yes)sets whether play, stop, pause, etc. controls are shown to the user.
The ScreenshotGallery can be used in an application to collect screenshots for that application. It can be used via scripting to get a list of taken screenshots and movies, to control to which directory these files are written, etc.
ScreenshotGallery is derived from Control.
Dynamic scripting: MLABScreenshotGalleryControl
ScreenshotGallery {
application = NAME
}The MDL WebView provides a complete web engine to the MDL developer. It is based on the open-source WebKit engine which as well powers Apple's Safari and Google Chrome.
It offers:
A standards compliant web browser.
JavaScript 1.5, CSS2, CSS3 and HTML5 Scripting interface to control the browser content, text selection, menu, etc.
Scripting interface to call browser JavaScript from MeVisLab Python/JavaScript.
Scripting of MeVisLab objects from within JavaScript (e.g., MLAB, ctx, etc.).
Support for NSAPI conformant browser plugins (e.g., Flash, Silverlight, etc.), typically plugins installed for Firefox plugins will just work.
Support for embedded MDL controls inside of HTML documents.
WebInspector for debugging HTML, CSS and JavaScript (Inspect option on context menu).
The WebView has a rich scripting API which you can find in the MeVisLab Scripting Reference (look for MLABWebViewControl).
The WebView has special support for local URLs that are relative to MeVisLab packages. You can write a URL relative to a MeVisLab package by writing href="/MLAB_PackageGroup_PackageName/...", e.g., href = "/MLAB_MeVisLab_Standard/Modules/Macros/Tests/GUI/TestWebView/Intro.html".
For detailed examples, have a look at the TestWebView module which shows most of the possibilities of the WebView.
WebView is derived from Control.
Dynamic scripting: MLABWebViewControl
WebView {
contentUrl = URL
contentFile = FILE
contentString = STRING
contentStringBaseUrl = URL
loadStartedCommand = SCRIPT
loadProgressCommand = SCRIPT
loadFinishedCommand = SCRIPT
enableScriptingObjects = BOOL [No]
enableEmbeddedMDL = BOOL [No]
enablePlugins = BOOL [No]
javaScriptInitCommand = SCRIPT
linkClickedCommand = SCRIPT
selectionChangedCommand = SCRIPT
linkDelegation = ENUM [Extern]
enableEmbeddedMDL = BOOL (default:
No)sets whether MDL control are embedded inside of HTML pages using the HTML object tag. Have a look at the TestWebView module for an example of embedded MDL.
The window/panel/module parameters are optional. If no module is given, the current module associated with the MDL file is used. If no window is given, the default window is used. If a panel is given, MeVisLab searches for an MDL section with panelName equal to the given panel name.
<object type="text/mevislab-mdl" > <param name="window" value="nameOfSomeMDLWindow"> </param> <param name="panel" value="nameOfSomePanel"> </param> <param name="module" value="instanceNameOfModule"></param> </object>
linkDelegation = ENUM (default: External)defines how clicks on links are handled. All links that are delegated are passed to the linkClickedCommand instead of switching the WebView to the Url internally. By default, all external links (which are not file:// links) are delegated. If the linkClickedCommand is not implemented, the delegated URLs are passed to MeVisLab, which uses the default programs registered for the scheme of the url to open the URL.
None: no links are delegated
External: external links (which do not point to the local disk using file://) are delegated
All: all links that are clicked are delegated
Accel allows to add keyboard shortcuts that trigger fields or execute a Python or JavaScript command when pressed. They are local to the window they are declared in, thus they are only triggered when their parent window is active.
Accel can appear inside of all Group GUI controls. The field and command tags are both optional. Note that Accel should be stated before the other GUI controls for which the defined shortcuts should be available. I.e., if a certain shortcut should be available for a whole window, state the according Accel statement right at the beginning, just after the Window statement.
Dynamic scripting: MLABAccelControl
Accel {
key = KEYSEQUENCE
field = FIELD
command = SCRIPT
}The EventFilter is an invisible GUI control that can be placed anywhere in the GUI. It allows to listen to the events that other controls (and optionally their children) receive and can then either prevent the event from being delivered or just pass through the event. It is a very powerful control since it allows to react on GUI events on a low level. You can e.g., use it to teach other controls drag-and-drop features, to notice when a window gets visible/hidden or when a control gets entered with the mouse and much more.
Dynamic scripting: MLABEventFilterControl
EventFilter {
name = NAME
command = SCRIPT
filter = NAMELIST
eatEvent = BOOL [No]
children = BOOL [No]
debug = BOOL [No]
control = NAME
...
}name = NAMEsets the name of the EventFilter, for usage with ctx.control() method.
command = SCRIPT (argument: event as map,
see below)defines a script command that is called for each event that matched the filter.
filter = NAMELISTa list of event names that should be filtered.
eatEvent = BOOL (default: No)sets whether the filtered events are eaten automatically (=not delivered).
children = BOOL (default: No)sets whether the filter is applied to all subwidgets or just to the given controls.
debug = BOOL (default: No)sets whether all events are printed to the console (just to see which events happen and which you might be interested in).
control = NAMEsets the name of the control to filter events on. This tag can appear multiple times so that the filter listens to multiple controls at a time.
The filter can contain a number of Event names. These names are take from Qt. You can find the event details at http://doc.qt.nokia.com/4.6/qevent.html.
All events share the type property, which
can be checked if multiple events are filtered. To print all
properties of an event, use the JavaScript:
for (i in event) MLAB.log(i + ":" +
event[i])
The most useful events are:
MouseButtonPress, MouseButtonRelease, MouseButtonDblClick,
MouseMovereact on mouse button press or release and movement.
Event properties: x, y, globalX, globalY, button (one of "left","mid","right"), ctrlKey, shiftKey, altKey
Show, Hidereacts on a control being shown or hidden.
Event properties: none (except type)
Enter, Leavereacts on mouse entering or leaving the control area.
Event properties: none (except type)
DragEnter, DragMove, Drophandles drag-and-drop on a low level.
Event properties: x, y, globalX, globalY
Wheelhandles the mouse wheel event.
Event properties: x, y, globalX, globalY, delta, orientation (one of "vertical","horizontal"), ctrlKey, shiftKey, altKey
Resizehandles resize event.
Event properties: width, height, oldWidth, oldHeight
KeyPress, KeyReleasehandles the key press event, where "ascii" is the ascii char, the text is unicode and the key can be used to access special keys, e.g., "Left", "Right" for cursor keys. See the Qt key defines or have a look at the example in TestEventFilter.
Event properties: ascii, text, key, ctrlKey, shiftKey, altKey
Example 4.28. EventFilter
Have a look at the module TestEventFilter. This module features the reacting of certain areas of the GUI on defined mouse actions (button pressed, entered/leave, etc.) and the implementation of dragging and dropping of files or images.
This chapter explains other options used in many GUI controls: the layout engine, rich text and the MDL styles.
By default, various GUI Controls are laid out depending on each other, e.g., Field controls in a Vertical automatically get the same label size, etc. This behavior can explicitly be specified by the concept of "Align Groups". A group is specified by its unique name, which you have to choose. All controls which are in the same group are aligned in respect to the type of the group.
There are three type of groups (given by their tag names):
In simpler words: if two controls, e.g., Fields in the same Vertical, have the same alignGroup tag, all the subwidgets in the Field controls are aligned well in their widths.
The labelAlignGroup can be used to just align the labels, so
that the other children of a Control will not be aligned. Have a look
at the TestLayouter MacroModule in MeVisLab,
which shows the differences.
In addition to the above tags, which are used directly inside of a control that should be aligned, you can also use the childAlignGroupX (alias childAlignGroup) and childAlignGroupY tags, which can be specified in any control that has children. This causes all "simple" controls inside this control to get the specified align group. So you can just see it as a helper tag that helps you write less tags:
Vertical {
childAlignGroup = group1
Box {
Field test1 { }
Field test2 { }
}
Box {
Field test3 { }
Field test4 { }
}
}This is identical to the following, note that the boxes do not get the alignGroup and that the childAlignGroup tag works recursively.
Vertical {
Box {
Field test1 { alignGroup = group1 }
Field test2 { alignGroup = group1 }
}
Box {
Field test3 { alignGroup = group1 }
Field test4 { alignGroup = group1 }
}
}The labelAlignGroup tag can also be used at a higher level and
it causes all "simple" controls to get their labels aligned. See the
TestLayouter MacroModule in MeVisLab for an
example of the above tags.
The following tabels give you an overview of which tags are
available in RichText. The RichText can be used in tooltips, whatsthis
boxes, Label, HyperText, HyperLabel and various other places. The
syntax is a simple subset of HTML, including lists, tables, images and
links. Have a look at the TestHyperText module
in MeVisLab to see some examples.
| Table tags | Notes |
|---|---|
<table>...</table> | A table. Tables support the following attributes:
|
<tr>...</tr> | A table row. This is only valid within a table. Rows
support the following attribute:
|
<th>...</th> | A table header cell. Similar to td, but
defaults to center alignment and a bold font. |
<td>...</td> | A table data cell. This is only valid within a table
row. Cells support the following attributes:
|
| Special tags | Notes |
|---|---|
<img> | An image. The image name for the mime source factory
is given in the source attribute, for example <img
src="qt.xpm">. The image tag also understands the
attributes width and height that determine the size of the
image. If the pixmap does not fit the specified size it will
be scaled automatically The align attribute determines where
the image is placed. By default, an image is placed inline
just like a normal character. Specify left or right to place
the image at the respective side. |
<hr> | A horizontal line. |
<br> | A line break. |
<nobr>...</nobr> | No break. Prevents word wrap. |
| Style tags | Notes |
|---|---|
<em>...</em> | Emphasized. By default this is the same as
<i>...</i> (italic). |
<strong>...</strong> | Strong. By default this is the same as
<b>...</b> (bold). |
<i>...</i> | Italic font style. |
<b>...</b> | Bold font style. |
<u>...</u> | Underlined font style. |
<s>...</s> | Strike out font style. |
<big>...</big> | A larger font size. |
<small>...</small> | A smaller font size. |
<code>...</code> | Indicates code. By default this is the same as
<tt>...</tt> (typewriter). For
larger chunks of code, use the block-tag
<pre>. |
<tt>...</tt> | Typewriter font style. |
<font>...</font> | Customize the font size, family and text color. The
tag can have the following attributes:
|
| Anchor tags | Notes |
|---|---|
<a>...</a> | An anchor or link.
|
| Structuring tags | Notes |
|---|---|
<qt>...</qt> | A Qt rich text document. It can have the following
attributes:
|
<h1>...</h1> | A top-level heading. |
<h2>...</h2> | A sublevel heading. |
<h3>...</h3> | A sub-sublevel heading. |
<p>...</p> | A left-aligned paragraph. Adjust the alignment with
the align attribute. Possible values are left,
right and center. |
<center>...</center> | A centered paragraph. |
<blockquote>...</blockquote> | An indented paragraph that is useful for quotes. |
<ul>...</ul> | An unordered list. You can also pass a type argument
to define the bullet style. The default is
type="disc"; other types are
circle and square. |
<ol>...</ol> | An ordered list. You can also pass a type argument to
define the enumeration label style. The default is
type="1"; other types are "a" and
"A". |
<li>...</li> | A list item. This tag can be used only within the
context of <ol> or
<ul>. |
<pre>...</pre> | For larger chunks of code. Whitespaces in the contents are preserved. For small bits of code, use the inline-style code. |
Styles can be defined globally but also locally in a user
interface to change the GUI appearance. Every control supports the
style tag, where you can give a style
by its name (declared with DefineStyle) or by just opening a local
style and deriving from the current style.
Example: See TestStyles macro module in MeVisLab.
DefineStyle allows to define a new GUI style, either complete or just extending an existing style. The style provided with MeVisLab is called "default". Old ILAB4 styles are also supported, being defaultVerySmall, defaultSmall, defaultBig, defaultHuge. These styles should no longer be used and are replaced by the scale tag, with which you can resize all fonts in a GUI control by just giving the scale tag and a positive or negative integer for bigger/smaller fonts and spacings.
Styles can be used to change the whole user interface appearance or just to change a single color/font in a given control. See below for an example on how to do that.
A style contains Fonts, Colors and Prototypes. You can specify a different font for each of the following roles:
Titles (titleFont tag)
Editable text (editFont tag)
TabBar text (tabFont tag)
Box group titles (boxFont tag)
There are two different sets of colors, the default colors and the disabledColors specifies which colors a
control uses when it is drawn. The disabledColors are used when a
control is not enabled (also called "grayed out").
DefineStyle NAME {
derive = NAME
// font for titles in the GUI (Buttons, Labels, ...)
titleFont {
family = NAME
size = INT
weight = ENUM
italic = BOOL
fixedPitch = BOOL
}
// font for editing components in the GUI (NumberEdit, TextView, ...)
editFont {
// see titleFont
}
// font for TabViews
tabFont {
// see titleFont
}
// font for Box group titles
boxFont {
// see titleFont
}
colors {
fg = COLOR
bg = COLOR
button = COLOR
buttonText = COLOR
editText = COLOR
editBg = COLOR
light = COLOR
midlight = COLOR
dark = COLOR
mid = COLOR
shadow = COLOR
highlight = COLOR
highlightedText = COLOR
brightText = COLOR
link = COLOR
linkVisited = COLOR
boxText = COLOR
tabText = COLOR
}
disabledColors {
// same as above colors
}
}derive = NAMEselect a style to derive from, all attributes are copied and you may overwrite any of the tags, e.g., just the font sizes, an individual colors etc.
titleFont, editFont,
boxFont, tabFontdefines properties of a font (you do not need to specify all tags, reasonable defaults are taken from the underlying system settings.
family = NAMEspecify a font family name; possible names are: Helvetica, Courier, ...
size = INTset the point size of the font.
weight = ENUMset the weight of the font.
Possible values: Light, Normal, DemiBold, Bold, Black
italic = BOOLset if font should be italic.
fixedPitch = BOOLset if the font should be fixed pitch (depends on font family).
colors,
disabledColorsdefine the normal colors and the disabled colors for all controls in this style.
The syntax for COLOR in the style is:
colorname[:imagefilename]
where colorname can be one of:
#rrggbb
X11 color name (also on Windows)
name specified in Colors section
and imagefilename can be an extra image used as brush for that color. Using images is especially interesting for the background colors bg, editBg and button.
Examples:
bg = black:$(LOCAL)/someBackgroundImage.png editBg = white
fg = COLORforegound text color used in Labels etc.
bg = COLORbackground color.
button = COLORbackground color of buttons.
buttonText = COLORtext color on buttons.
editText = COLOReditBg = COLORcolor for editable text and background for text edits.
light = COLOR midlight = COLOR dark =
COLOR mid = COLOR shadow
= COLORcolors used for drawing sunken and raised panels and buttons.
highlight = COLOR highlightedText = COLORhighlight background and text color, e.g., for text selection and ListViews.
brightText = COLORtext with good contrast to "dark" color.
link = COLOR linkVisited = COLORcolor used for drawing links and visited links (in RichText).
boxText = COLORcolor of box titles.
tabColor = COLORcolor of TabBar titles.
© 2011 MeVis Medical Solutions AG