Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - 日本語

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

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

Scilabヘルプ >> Graphics > property > set

set

グラフィックエンティティオブジェクトまたは またはユーザインターフェイスオブジェクトのプロパティの値を設定する.

呼び出し手順

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)

引数

h
名前のあるプロパティを設定するエンティティの グラフィックハンドル. h はハンドルのベクトルとすることができ, この場合,プロパティを修正すると,hに含まれる全てのエンティティに 適用されます.

tagsPath
Case-sensitive character string providing the tag or the tags-path leading to the graphic component to process. このパスはgraphicエンティティ"Tag" プロパティおよび "figuretag/entitytag" (エンティティが図の子の場合)形式による グラフィック階層におけるその親の"Tag"プロパティ から構成されます.

"figuretag/entity1tag/entity2tag/entityntag/entitytag"のように より深い階層レベルも使用できます. 複数のパスを検索する際にワイルドカードも使用できます. パスに一致した最初のエンティティが使用されます.

prop, prop2, ...
大文字と小文字を区別しない文字列:設定するプロパティの名前.

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.

説明

このルーチンはグラフィックエンティティまたはGUIオブジェクトの 特定のプロパティの値を修正する際に使用できます. この場合,ハンドルにドット演算子を使用するのと等価です. 例えば,set(h,"background",5)h.background = 5と等価です.

存在するプロパティの全リストを取得するには, graphics_entities または (ユーザインタフェースオブジェクトについては)uicontrolを 参照ください.

set(h, prop, val) or h(prop) = val or 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.

gda().auto_clear = "off";
clf
// 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);

// 名前のあるプロパティをオブジェクト固有の値に設定
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);

With a vector of handles:

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

参照

  • get — グラフィックエンティティまたはユーザーインターフェイスオブジェクト からプロパティの値を取得する.
  • scf — カレントの図に指定する (window)
  • sdf — デフォルトの図(figure)を設定.
  • sca — カレントの軸のエンティティを設定する
  • sda — デフォルトの軸(Axes)を設定.
  • delete — グラフィックエンティティとその子を削除.
  • copy — グラフィックエンティティをコピー.
  • move — グラフィックエンティティおよびその子を移動, 変換する
  • graphics_entities — グラフィックスエンティティデータ構造体の説明

履歴

VersionDescription
5.5.0
  • 最初の入力引数をグラフィックエンティティを指すパスとすることが できるようになりました.
  • 複数のプロパティ設定を一度に利用できるようになりました.
Report an issue
<< get property text >>

Copyright (c) 2022-2023 (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:53:23 CET 2020