Multiselection at run time
Multiple selection of primitives at run time
-
New panel attribute "Runtime Selection" to turn on (default = off). The option to activate the selection of primitive shapes in a vision module.
-
New primitive shape attribute: "selectable" (change in Gedi only). Defines whether a shape is selectable at runtime.
-
New primitive shape attribute: "selected" (CTRL read or write) state of selection. Only changeable if the shape is selectable.
-
New primitive shape event: "SelectionChanged". This is triggered whenever the "selected" state of a shape changes, either interactively by the user selecting the shape or by the CTRL programmer setting the "selected" attribute programmatically.
-
New shape attribute (CTRL read only): "shapeType". Returns a string specific to the type of shape.
Here the complete list:
"PRIMITIVE_TEXT", "LINE", "RECTANGLE", "ELLIPSE", "ARC", "POLYGON", "PUSH_BUTTON", "TEXT_FIELD", "CLOCK", "SELECTION_LIST", "RADIO_BOX", "CHECK_BOX", "SPIN_BUTTON", "COMBO_BOX", "TREND", "TABLE", "CASCADE_BUTTON", "BAR_TREND", "TAB", "ACTIVE_X", "FRAME", "PIPE", "DP_TREE", "TEXT_EDIT", "SLIDER", "THUMB_WHEEL", "PROGRESS_BAR", "TREE", "DPTYPE", "LCD", "ZOOM_NAVIGATOR", "EMBEDDED_MODULE" |
EWOs show their own special type name. This shapeType will also be displayed in the GEDI status bar when this shape has been selected.
-
New CTRL Function:
dyn_string getShapes(string moduleName = myModuleName(),
string panelName = myPanelName(),
string attribute = "selected",
anytype value = true)
This function returns a list of shape names (or RefName.ShapeName when a shape is inside a PanelRef) chosen according to the given selection arguments:
moduleName: Module name of the panel. The default is myModuleName().
panelName : What Panel The default is myPanelName().
attribute : A simple attribute name of a shape, for example, "foreCol", "selected", "visible".
All attributes which return a single data type can be used (for example, not possible with "position");
default: "selected".
value : The value that specifies that an attribute must include a shape in the resulting list.
The default is true.
Example
Get a list of all shapes with the background color {255,255,255} and set them to be selected:
main()
{
dyn_string shapes;
shapes = getShapes(myModuleName(), myPanelName(),
"backCol", "{255,255,255}");
for (int i = 1; i <= dynlen(shapes); i++)
{
setValue(shapes[i], "selected", true);
}
}
Example
Get a list of all "TEXT_FIELD"; shapes:
dyn_string shapes = getShapes(myModuleName(), myPanelName(),
"shapeType", "TEXT_FIELD");
-
To be able to access the $-parameters for a given PanelRef, a Panel Reference possess a new readable attribute"dollars". The result is a mapping whereby the key is the $-parameter name
and the value is the $ parameter value. for example,
mapping params;
getValue("Ref1", "dollars", params);
DebugN(params["$DP"]);