Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.1 - Français

Change language to:
English - 日本語 - 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

Aide de Scilab >> Graphiques > property > set

set

set a property value of a graphic entity object or of a User Interface object.

Syntax

set(prop,val)
set(h,prop)
set(h,prop,val)
set(handlePath,prop,val[,prop2, val2, ..., propn, valn])
h.prop=val

Arguments

h

graphic handle of the entity which to set the named property. h can be a vector of handles, in which case set modifies the property for all entities contained in h.

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/entityntag/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 to set.

val

value to give to the property.

Description

This routine can be used to modify 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, set(h,"background",5) is equivalent to h.background = 5.

Property names are character strings. The type of the set values depends on the handle type and property.

To get the list of all existing properties see graphics_entities or uicontrol for User Interface objects.

set function can be also called with only a property and a value as argument. In this case, the property must be one of the following:

current_entity or hdl

set('current_entity',h) or set('hdl',h) sets a new entity as current. In this case, the value must be a graphic handle.

current_figure

set('current_figure',fig) sets a new graphic figure as current. It is equivalent to scf. In this case, the value must be a Figure handle.

current_axes

set('current_axes',axes) sets a new axes entity as current. It is equivalent to sca. In this case, the value must be an Axes handle.

set can also be called with a graphic handle and property as arguments. The handle must be either a handle on the default figure or the default axes entities. The property must be "default_values". In this case, the default entity is reset to the value it had at Scilab startup. set("default_values",h) is equivalent to sda or sdf.

Examples

clf()
set("auto_clear","off") ;
// Example of a Plot 2D
x=[-.2:0.1:2*%pi]';
plot2d(x-.3,[sin(x-1) cos(2*x)],[1 2] );
a=get("current_axes");
p1=a.children.children(1);
p2=a.children.children(2);
// set the named properties to the specified values on the objects
set(p2,"foreground",13);
set(p2,"polyline_style",2);
set(a,'tight_limits',"on");
set(a,"box","off");
set(a,"sub_tics",[ 7 0 ]);
set(a,"y_location","middle")
set(p2,'thickness',2);
set(p1,'mark_mode',"on");
set(p1,'mark_style',3);
plot2d(x-2,x.^2/20);
p3= a.children(1).children;
set([a p1 p2 p3],"foreground",5)

// 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

  • get — Retrieve a property value from a graphics entity or an User Interface object.
  • delete — delete a graphic entity and its children.
  • copy — copy a graphics entity.
  • move — move, translate, a graphic entity and its children.
  • graphics_entities — description of the graphics entities data structures
  • uicontrol — create a Graphic User Interface object

History

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 Compound properties >>

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 Feb 12 19:15:32 CET 2018