Skip to content

addproperty

builtin · libnexusinterp/corefcn/graphics-proprietary.cc

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

Add a new property called name to the graphics object h.

type names the kind of property to create. The trailing arguments normally supply its default value, though some property types expect further details as well.

The recognized property types are:

string

Holds a character string; arg is the default string.

any

An untyped property able to hold any Nexus value; arg is the default value.

radio

A string restricted to a fixed set of choices. The first argument lists the accepted values separated by vertical bars (‘|’); the default may be marked by wrapping it in a ‘{’ ‘}’ pair, or supplied separately as an optional second string.

boolean

A property that is either on or off, equivalent to a radio property with the choices "on|off"; arg is the default value.

double

A scalar double value; arg is the default.

handle

Holds the handle of a graphics object; arg is the default handle, or the empty matrix when none is given.

data

Holds a numeric matrix; arg is the default data, or the empty matrix when none is given.

color

Holds a color value; arg is the default, or black when none is given. An optional second string argument may list extra accepted string values, as for a radio property.

alias

Reads and writes another property of h, named by arg. An optional second name is used instead when the Location of h starts with north or south, and an optional third argument, "cellcolumn" or "first", reads the value as a column cellstr or its first element.

type may instead be a core object type name joined with one of that object’s property names. The new property then copies the characteristics of the referenced property, including its type, permitted values, and hidden state, which makes it possible to clone an existing property onto 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", "--");