Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
get
Gets the handle of a graphical or User Interface object, or the property's value of objects.
Syntax
h = get(0) // console h = get(tag) h = get(tagsPath) h = get(key) fids = get("figures_id") val = H.prop val = H(prop) val = get(0, prop) val = get(H, prop) val = get(tag, prop) val = get(tagsPath, prop)
Arguments
- h
Scalar handle of the first found targeted graphical or user Interface object.
- H
Handle or vector of handles of the targeted graphical or user Interface objects. When
H
is a vector of handles, addressed entities may be of different graphical types, but all of them must have the given property, otherwise an error is yielded.- fids
vector of indices of all opened figures.
- 0 (zero)
Special id addressing the console and its properties.
- tag
case-sensitive tag's value of the targeted object. Values equal to a documented
key
have a special meaning and must not be used as tag (please see below).- tagsPath
A single case-sensitive character string containing a path pointing to the graphic entity. This path is made of the
"Tag"
values of the targeted entity and of its ascendants in the graphical hierarchy, under the format"targetTag"
or"figuretag/targetTag"
or"figuretag/entity1tag/entity2tag/entitntag/targetTag"
. Wildcards "*" can also be used for multi-paths search. The first entity matching the path will be used.- prop
text: case-insensitive name of the single property whose value must be retrieved. To get the list of all existing properties, see graphics_entities or uicontrol for User Interface objects. An error is yielded if the property does not exist for the targeted object.
- key
A keyword among the following ones:
"current_entity" or "hdl": returns the handle on the lastly created (and still existent) entity. get("current_entity")
is equivalent to gce()."current_figure": returns the 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().- val
Corresponding value of the targeted property.
Description
get(..) allows two types of actions:
- retrieving the handle or index of a targeted object, according to its tag, to a tagspath leading to it, or to some key for special targets.
- retrieving the value of a given property for a given object.
- the Scilab console
- any opened graphical figures and all their contents
- any existing interactive components, including uicontrol objects, menus, waitbars and progressionbars.
Objects with properties .visible="off" or/and
.handle_visible="off" , or/and rendered off-screen out of the
driver("REC") , are still always reachable. |
Getting the handle of an object
[] is returned anyway if no matching object is found.
h = get(0) returns the handle of Scilab's console.
h = get(tag) returns the handle of the first
object found with .tag==tag
.
h = get(tagsPath) returns the handle of the first
object found with a tag's path matching tagspath
.
h = get(key) returns the special object
according to the key
string, as documented in the
Arguments section.
fids = get("figures_id") returns the vector
of indices of all existing graphical figures.
This is equivalent to winsid()
Value of a property
val = get(0, prop) returns the value of the given Root or Console property.
val = get(H, prop) or
val = H(prop) or even more simply
val = H.prop returns the value of the
prop
property for the object whose handle is H
.
If H
is a vector of handles, and if the expected value of the
property
- is scalar: then
val
returns a column of the values for all objects inH
. Example:--> plot2d(), get([gcf() gca() gce()], "visible") ans = "on" "on" "on"
- is NOT scalar: then
val
returns the vertical concatenation of the values returned for all objects inH
. Example:--> clf, plot --> get(gcf().children(1), "data_bounds") ans = 1. -1. 2. 1. --> get(gcf().children, "data_bounds") ans = 1. -1. 2. 1. 0. -1. 6.2831853 1.
The H.prop syntax is the most compact and powerful, and should
be preferred. Noticeably, when it is meaningful, it can be chained in a
straightforward way as in H.prop1.prop2.prop , without
intermediate handles or/and explicitly nested calls to get(). Example:
Axes.children.children.foreground is equivalent to
get(get(get(get(topAxes, "children"),"children"),"children"),"foreground") . |
val = get(tag, prop) returns the value of the
property prop
for the first object found whose
.tag==tag
.
val = get(tagsPath, prop) returns the value of
the property prop
for the first object found whose location
in the graphical hierarchy and whose .tag match tagsPath
.
Examples
close(winsid()) scf(); scf(2); plot2d f1 = gcf(); // or f1 = get("current_figure"); f1.axes_size // or get(f1, "axes_size") f2 = scf(7); plot h = gce() // or h = get("current_entity") h.children(1:4).foreground // Colors of 4 first curves axes = gcf().children // or get(gcf(), "children"); bottomAxes = gca(); // or bottomAxes = get("current_axes"); topAxes = axes($); topAxes.children.children.line_style // instead of get(get(get(get(topAxes, "children"),"children"),"children"),"line_style") [f1 f2].figure_id // of get([f1 f2], "figure_id") [f1 f2].anti_aliasing // of get([f1 f2], "anti_aliasing") // for User Interface objects h = uicontrol('string', 'Button'); // Opens a window with a button. p = h.position // or p = get(h,'position'); close(get("figures_id")); // close all figures
--> f1 = gcf(); // or f1 = get("current_figure"); --> f1.axes_size // or get(f1, "axes_size") ans = 610. 460. --> f2 = scf(7); --> plot --> h = gce() // or h = get("current_entity") h = Handle of type "Compound" with properties: ========================================== parent: Axes children: matrix 41x1 visible = "on" user_data = [] tag = "" --> h.children(1:4).foreground // Colors of 4 first curves ans = 36. 35. 34. 5. --> axes = gcf().children // or get(gcf(), "children"); axes = 2 by 1 matrix of handles: ========================= Axes Axes --> bottomAxes = gca(); // or bottomAxes = get("current_axes"); --> topAxes = axes($); --> topAxes.children.children.line_style ans = 2. 1. 4. --> [f1 f2].figure_id // of get([f1 f2], "figure_id") ans = 2. 7. --> [f1 f2].anti_aliasing // of get([f1 f2], "anti_aliasing") ans = "off" "off" --> // for User Interface objects --> h = uicontrol('string', 'Button'); // Opens a window with a button. --> p = h.position // or p = get(h,'position'); p = 20. 40. 40. 20.
Console special handle:
get(0) get(0, "screensize_px")
--> get(0) ans = Handle of type "Console" with properties: ========================================= Children: "uimenu" ShowHiddenHandles = "off" ShowHiddenProperties = "off" UseDeprecatedSkin = "off" user_data = [] tag = "" --> get(0, "screensize_px") ans = 1. 1. 1920. 1080.
Using tags and tagsPaths:
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"); get("myframe") == frameHandle 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
- findobj — find an object with specified property
- set — Ajusta um valor de propriedade de uma objeto entidade gráfica ou de um objeto Interface do Usuário (User Interface)
- console_properties — Description of console object properties.
- root_properties — description of the root object properties.
- graphics_entities — Descrição das estruturas de dados de entidades gráficas
- uicontrol_properties — Description of the uicontrol properties.
- gcf — Retorna o manipulador da janela GUI ou de gráficos corrente.
- gdf — Retorna o manipulador da figura corrente
- gca — Retorna o manipulador da entidade Axes corrente
- gda — Retorna o manipulador dos eixos padrões.
- gce — Retorna o manipulador da entidade corrente
- winsid — retorna a lista de janelas de gráficos
History
Versão | Descrição |
5.5.0 | The syntaxes h=get(tag), h=get(tagsPath), val=get(tagsPath,prop), and val=get(tagsPath, prop) are introduced. |
Report an issue | ||
<< property | property | set >> |