Navigation

Operators and Keywords

Function List:

C++ API

: addproperty (name, h, type)
: addproperty (name, h, type, arg, …)

Create a new property named name in graphics object h.

type determines the type of the property to create. args usually contains the default value of the property, but additional arguments might be given, depending on the type of the property.

The supported property types are:

string

A string property. arg contains the default string value.

any

An un-typed property. This kind of property can hold any octave value. args contains the default value.

radio

A string property with a limited set of accepted values. The first argument must be a string with all accepted values separated by a vertical bar (’|’). The default value can be marked by enclosing it with a ’{’ ’}’ pair. The default value may also be given as an optional second string argument.

boolean

A boolean property. This property type is equivalent to a radio property with "on|off" as accepted values. arg contains the default property value.

double

A scalar double property. arg contains the default value.

handle

A handle property. This kind of property holds the handle of a graphics object. arg contains the default handle value. When no default value is given, the property is initialized to the empty matrix.

data

A data (matrix) property. arg contains the default data value. When no default value is given, the data is initialized to the empty matrix.

color

A color property. arg contains the default color value. When no default color is given, the property is set to black. An optional second string argument may be given to specify an additional set of accepted string values (like a radio property).

type may also be the concatenation of a core object type and a valid property name for that object type. The property created then has the same characteristics as the referenced property (type, possible values, hidden state…). This allows one to clone an existing property into the graphics object h.

Examples:

addproperty ("my_property", gcf, "string", "a string value");
addproperty ("my_radio", gcf, "radio", "val_1|val_2|{val_3}");
addproperty ("my_style", gcf, "linelinestyle", "--");

See also: addlistener, hggroup.

Package: octave