getShapes()

This function returns a list of shape names (or RefName.ShapeName) which are located in given Module/Panel parameters and fit the wanted attribute and value pair.

Synopsis

dyn_string getShapes(string moduleName = myModuleName(),

string panelName = myPanelName(),

string attribute = "selected",

anytype value = true);

Parameters

Parameter Description
moduleName

The name of the Module, that contains the Panel, which is searched for shapes that match the given attribute.

The default is myModuleName().

panelName

The name of the Panel, which is searched for shapes.

The default is myPanelName().

attribute

The name of a simple shape attribute, for example, "foreCol", "selected", "visible" or similar. Only attributes which return single values are usable (e.g. "position" can not be used).

The default is "Selected"; A value of "" returns all shapes.

value

The value for the selected attribute (see parameter "attribute") that must be matched (e.g. the attribute background color must be black).

The default value is true.

Return value

The function returns a list of shape names (or RefName.ShapeName when a shape is inside a PanelRef).

Error

Missing arguments, incorrect function name

Description

The function searches through a Panel in a specific Module and returns all Shapes that match the selected attribute/value pair of the function. The searched attribute is restricted to attributes that return a single data type.

This function will use the strict mode and work like getShapesStrict() when the config entry [ui] strictAddressing is set.

Example 1

The following example gets a list of all shapes with the background color {255,255,255} and sets them to 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 2

The following example gets a list of all "TEXT_FIELD" shapes.

dyn_string shapes = getShapes(myModuleName(), myPanelName(), "shapeType", "TEXT_FIELD");

Assignment

Graphics functions

Availability

UI