Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Graphics > property > get

get

Retrieve a property value from a graphics entity or an User Interface object.

Syntax

h=get(prop)
val=get(h,prop)
val=get(handlePath,prop)
val=h.prop

Arguments

h

handle, the handle of the entity to retrieve a property. h can be a vector of handles, in which case get returns the property value for all objects contained in h. h can also be 0 to get the root object properties. Calling get(0) will return a "Console" handle with configuration properties.

handlePath

A character string containing a path pointing to the graphic entity. This path is made of the graphic entity "Tag" property and the "Tag" property of its parents in the graphics hierarchy under the format "figuretag/entitytag" (when the entity is the child of a figure).

Deeper hierarchy levels can also be used such as "figuretag/entity1tag/entity2tag/entitntag/entitytag". Wildcards can also be used for multi-paths search. The first entity matching the path will be used.

prop

character string name of the property.

val

value of the property.

Description

This routine can be used to retrieve the value of a specified property from a graphics entity or a GUI object. In this case it is equivalent to use the dot operator on a handle. For example, get(h,"background") is equivalent to h.background.

Property names are character strings. To get the list of all existing properties see graphics_entities or uicontrol for User Interface objects.

get function can be also called with only a property as argument. In this case, the property must be one of the following (called with other properties names, get will return []):

current_entity or hdl

returns a handle on the lastly created (and still existent) entity. get('current_entity') and get('hdl') are equivalent to gce.

current_figure

returns a handle on the current graphic figure. get('current_figure') is equivalent to gcf.

current_axes

returns a handle on the current axes entity. get('current_axes') is equivalent to gca.

default_figure

returns a handle on the default figure entity. get('default_figure') is equivalent to gdf.

default_axes

returns a handle on the default axes entity. get('default_axes') is equivalent to gda.

figures_id

returns a row vector containing ids of all opened graphic figures. get('figures_id') is equivalent to winsid.

Examples

// for graphics entities
 clf()

// simple graphics objects
subplot(121);
x=[-.2:0.1:2*%pi]';
plot2d(x-2,x.^2);
subplot(122);
xrect(.2,.7,.5,.2);
xrect(.3,.8,.3,.2);
xfarc(.25,.55,.1,.15,0,64*360);
xfarc(.55,.55,.1,.15,0,64*360);
xstring(0.2,.9,"Example <<A CAR>>");

h=get("current_entity") //get the newly object created
h.font_size=3;

f=get("current_figure") //get the current figure
f.figure_size
f.figure_size=[700 500];
f.children
f.children(2).type
f.children(2).children
f.children(2).children.children.thickness=4;

a=get("current_axes") //get the current axes
a.children.type
a.children.foreground //get the foreground color of a set of graphics objects
a.children.foreground=9;

// for  User Interface objects
h=uicontrol('string', 'Button'); // Opens a window with a  button.
p=get(h,'position'); // get the geometric aspect of the button
disp('Button width: ' + string(p(3))); // print the width of the button
close(); // close figure

// Using path
f = figure("dockable", "off", "menubar", "none", "toolbar", "none", "infobar_visible", "off", "tag", "mainfig");
frameHandle = uicontrol("parent", f, "style", "frame", "position", [200 200 190 100], "tag", "myframe");
btnHandle = uicontrol("parent", frameHandle, "position", [20 20 150 30], "string", "button", "tag", "example");

set("mainfig/myframe/example", "string", "complete path");
get("mainfig/myframe/example", "string")
set("mainfig/*/example", "string", "wildcard path");
get("mainfig/*/example", "string")
set("myframe/example", "string", "partial path");
get("myframe/example", "string")

See also

  • uicontrol — create a Graphic User Interface object
  • root_properties — description of the root object properties.
  • graphics_entities — description of the graphics entities data structures
  • set — set properties of some graphic objects or uimenus or uicontrol interactive components
Report an issue
<< property property set >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:49:21 CET 2020