Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2023.0.0 - Português


set

Ajusta um valor de propriedade de uma objeto entidade gráfica ou de um objeto Interface do Usuário (User Interface)

Seqüência de Chamamento

set(h, prop,val)            // h(prop) = val,  h.prop = val
set(h, prop,val, prop2,val2, ..)
set(tagsPath, prop,val)
set(tagsPath, prop,val, prop2,val2, ..)

set('current_figure', fig)  // scf(fig)
set('current_axes', axes)   // sca(axes)
set('current_entity', h)

Parâmetros

h
manipulador da entidade da qual a propriedade nomeada se deseja ajustar, h pode ser um vetor de manipuladores, em tal caso, serão ajustados valores de propriedades para todos os objetos identificados por h

tagsPath
Case-sensitive character string providing the tag or the tags-path leading to the graphic component to process. This path is made of the strings recorded in the .Tag property of the parent figure and of the chain of its children down to the target, like "figuretag" to target the figure with figure.tag=="figuretag", or "figuretag/entitytag" to target one of its children (as for an axes, a main uimenu item, a block of legends,..), or "figuretag/entity1tag/entity2tag", etc. Wildcards can also be used for multi-paths search.

prop, prop2, ...
Escalares strings : nome que não diferencia maiúsculas de minúsculas das propriedades a serem ajustadas.

val, val2, ...
value to assign to the property. Its type depends on the considered property. If h and val are vectors or matrices of same size, the multiple settings are done in an element-wise way.

fig
Handle of a graphical figure.

axes
Handle of an axes.

Descrição

Esta rotina pode ser utilizada para se recuperar o valor de uma propriedade especificada de uma entidade de gráficos ou objeto GUI. Neste caso, é equivalente a se usar o operador ponto ('.') em um manipulador. Por exemplo, set(h,"background",5) é equivalente a h.background = 5.

Para obter a lista de todas as propriedade existentes ver graphics_entities ou uicontrol para objetos de Interface do Usuário

set(h, prop, val) ou h(prop) = val ou h.prop = val

sets the property prop of the handle h to the value val..

When h is a matrix of handles,

  • if val is a matrix of same size: assignments are done in a element-wise way: set(h, prop, val) sets h(1)(prop)=val(1), h(2)(prop)=val(2), ..., h($)(prop)=val($). Most often, the simpler syntax h(tag) = val does it as well.
  • otherwise: The same and whole val value (that may be scalar or not) is assigned to every h(i)(prop) component.
    If val is a cell array of same size as h, it is assigned as a whole as well. For instance, set([gcf() gca()], "user_data", {"Text", 1}) will do gcf().user_data = {"Text", 1}, gca().user_data = {"Text", 1}, not gcf().user_data = "Text", gca().user_data = 1.

With this syntax, prop can't be an array of property names. To set multiple properties with a single call to set(..), the following syntax must be used.

set(h, prop1,val1, prop2,val2, ..)

sets the property prop1 of the handle(s) h to the value val1, its or their property prop2 to the value val2, etc. If h and some val# are matrices of same size, element-wise assignments are done for the related prop# properties, as already described for the set(h, prop, val) syntax.

set(tagsPath, prop,val) or set(tagsPath, prop,val, prop2,val2, ..)

Identifying the targeted component(s) to be set can be done as well through their .tag property instead of their handle. This is achieved through the tagsPath.

In case of multiple entities matching the path, only the first one is processed. Conversely, finding no matching entity yields an error.

set("current_figure", fig)

sets the figure of handle fig as the active figure. This syntax is equivalent to scf(fig) or scf(figure_id), that are shorter and may be prefered.

set("current_axes", axes)

sets the axes of handle axes as the active one. This syntax is equivalent to sca(axes) that is shorter and may be prefered.

set("current_entity", h)

sets the graphical component whose h(1) is the handle as the current component, as returned by gce(). If h is a vector of handles, other components h(2:$) are ignored.

Exemplos

gda().auto_clear = "off";
clf
// Example with a Plot 2D
x = [-.2:0.1:2*%pi]';
plot2d(x-.3, [sin(x-1) cos(2*x)], [1 2] );
a = gca();
p1 = a.children.children(1);
p2 = a.children.children(2);

// ajustando as propriedades nomeadas para os valores especificados nos objetos
p2.thickness = 2;
set(p2, "foreground",13, "polyline_style",2);
a.y_location = "middle";
a.tight_limits = "on";
set(a, "box","off", "sub_tics",[7 0]);
set(p1, "mark_mode","on", "mark_style",3);

plot2d(x-2,x.^2/20);
p3 = a.children(1).children;
set([a p1 p2 p3], "foreground",5);

Com um vetor de manipuladores gráficos :

// With distinct element-wise inputs:
clf, plot2d()
[gcf() gca()].tag
set([gcf() gca()], "tag", ["myFigure" "myAxes"]);
[gcf() gca()].tag
--> [gcf() gca()].tag
 ans  =
!  !
!  !

--> set([gcf() gca()], "tag", ["myFigure" "myAxes"]);

--> [gcf() gca()].tag
 ans  =
!myFigure  !
!myAxes    !

// With the same input for all recipients:
clf, plot()
curves = gce().children;
set([gca() ; curves], "thickness", 2);
curves(1:20).thickness = 1; // shorter than set(curves(1:20), "thickness", 1)

Using a tagsPath :

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")

Histórico

VersionDescription
5.5.0
  • First input argument can now be a path pointing to the graphic entity.
  • Multiple property setting is now available at once.
Report an issue
<< get property text >>

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:
Mon Mar 27 09:49:54 GMT 2023