Next: , Previous: , Up: Graphics Data Structures   [Contents][Index]

15.3.4 Searching Properties

: h = findobj ()
: h = findobj (prop_name, prop_value, …)
: h = findobj (prop_name, prop_value, "-logical_op", prop_name, prop_value)
: h = findobj ("-property", prop_name)
: h = findobj ("-regexp", prop_name, pattern)
: h = findobj (hlist, …)
: h = findobj (hlist, "flat", …)
: h = findobj (hlist, "-depth", d, …)

Find graphics object with specified property values.

The simplest form is

findobj (prop_name, prop_value)

which returns the handles of all objects which have a property named prop_name that has the value prop_value. If multiple property/value pairs are specified then only objects meeting all of the conditions are returned.

The search can be limited to a particular set of objects and their descendants, by passing a handle or set of handles hlist as the first argument.

The depth of the object hierarchy to search can be limited with the "-depth" argument. An example of searching only three generations of children is:

findobj (hlist, "-depth", 3, prop_name, prop_value)

Specifying a depth d of 0, limits the search to the set of objects passed in hlist. A depth d of 0 is equivalent to the "flat" argument.

A specified logical operator may be applied to the pairs of prop_name and prop_value. The supported logical operators are: "-and", "-or", "-xor", "-not".

Objects may also be matched by comparing a regular expression to the property values, where property values that match regexp (prop_value, pattern) are returned.

Finally, objects may be matched by property name only by using the "-property" option.

Implementation Note: The search only includes objects with visible handles (HandleVisibility = "on"). See findall, to search for all objects including hidden ones.

See also: findall, allchild, get, set.

: h = findall ()
: h = findall (prop_name, prop_value, …)
: h = findall (prop_name, prop_value, "-logical_op", prop_name, prop_value)
: h = findall ("-property", prop_name)
: h = findall ("-regexp", prop_name, pattern)
: h = findall (hlist, …)
: h = findall (hlist, "flat", …)
: h = findall (hlist, "-depth", d, …)

Find graphics object, including hidden ones, with specified property values.

The return value h is a list of handles to the found graphic objects.

findall performs the same search as findobj, but it includes hidden objects (HandleVisibility = "off"). For full documentation, see findobj.

See also: findobj, allchild, get, set.

Next: , Previous: , Up: Graphics Data Structures   [Contents][Index]