Skip to content

Commit 04d8da5

Browse files
motteletdavidcl
authored andcommitted
* Bug 7117 fixed: now findobj() can search within given object
http://bugzilla.scilab.org/show_bug.cgi?id=7117 help page: http://bugzilla.scilab.org/attachment.cgi?id=5153 Change-Id: I1c8c1e4b95b6b36686bdf1de7de5920ec3f2b0c6
1 parent 5c22e8c commit 04d8da5

File tree

5 files changed

+196
-166
lines changed

5 files changed

+196
-166
lines changed

SEP/SEP_135_findobj.odt

27.6 KB
Binary file not shown.

scilab/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ Bug Fixes
275275

276276
### Bugs fixed in 6.1.1:
277277
* [#3188](https://bugzilla.scilab.org/3188): `part()` was slower than in Scilab 4.1.2.
278+
* [#7117](https://bugzilla.scilab.org/7117): `findobj()` could not search within given object.
278279
* [#8059](https://bugzilla.scilab.org/8059): A local `.wgetrc` config file could make troubles in `atomsDownload`.
279280
* [#8378](https://bugzilla.scilab.org/8378): Datatip `ContextMenu => Delete last datatip` was useless.
280281
* [#9909](https://bugzilla.scilab.org/9909): In the help browser, add a way to open the online version of the current page.

scilab/modules/gui/help/en_US/findobj.xml

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
<refsynopsisdiv>
88
<title>Syntax</title>
99
<synopsis>
10-
h = findobj(propertyName, propertyValue)
10+
h = findobj()
11+
h = findobj(propertyName, propertyValue)
12+
h = findobj(propertyName, propertyValue, operator, propertyName, propertyValue, ...)
13+
h = findobj("-property", propertyName, ...)
14+
h = findobj(searchHandles, ...)
15+
h = findobj(..., '-depth', d, ...)
16+
h = findobj(..., '-flat', ...)
1117
</synopsis>
1218
</refsynopsisdiv>
1319
<refsection>
@@ -22,31 +28,60 @@
2228
<varlistentry>
2329
<term>propertyValue</term>
2430
<listitem>
25-
<para>string character specify the value the tested property should be equal to (case sensitive).</para>
31+
<para>character string specify the value the tested property should be equal to (case sensitive).</para>
32+
</listitem>
33+
</varlistentry>
34+
<varlistentry>
35+
<term>operator</term>
36+
<listitem>
37+
<para>character string belonging to the set {"-and", "-or", "-not"}.</para>
38+
</listitem>
39+
</varlistentry>
40+
<varlistentry>
41+
<term>searchHandles</term>
42+
<listitem>
43+
<para>Vector of graphic handles where the search is restricted to.</para>
44+
</listitem>
45+
</varlistentry>
46+
<varlistentry>
47+
<term>d</term>
48+
<listitem>
49+
<para>positive integer, the depth of the search.</para>
2650
</listitem>
2751
</varlistentry>
2852
<varlistentry>
2953
<term>h</term>
3054
<listitem>
31-
<para>handle of the found object.</para>
55+
<para>handles of the found objects.</para>
3256
</listitem>
3357
</varlistentry>
3458
</variablelist>
3559
</refsection>
3660
<refsection>
3761
<title>Description</title>
3862
<para>
39-
This routine is currently used to find objects knowing their 'tag'
40-
property. It returns handle of the first found object which property
41-
<emphasis role="italic">propertyName</emphasis> is equal to <emphasis role="italic">propertyValue</emphasis>. If such an object does not exist, the
63+
Without arguments <literal>findobj</literal> returns handles of all graphic objects and their descendants. If such an object does not exist, the
4264
function returns an empty matrix.
4365
</para>
66+
<para>
67+
<literal>findobj(propertyName, propertyValue, ...)</literal> returns the handles of objects having the property <literal>propertyName</literal> set to <literal>propertyValue</literal>.
68+
If successive property/vaue pairs are given the handles of objects verifing all conditions are returned, i.e. there is an implicit <literal>"-and"</literal> operator between pairs.
69+
Another operator can be explicitely given with <literal>findobj(propertyName, propertyValue, operator, propertyName, propertyValue, ...)</literal>.
70+
</para>
71+
<para>The priority of evaluations in a composite condition using operators can be controlled by using a cell argument, e.g. <literal>findobj({propertyName, propertyValue, ...}, operator, ...)</literal>
72+
</para>
73+
<para>
74+
<literal>findobj("-property", propertyName, ...)</literal> returns the handles of objects having the property <literal>propertyName</literal>. Other conditions can be added.
75+
</para>
76+
<para>
77+
By default the search is done within all figures and <literal>findobj(searchHandles, ...)</literal> restricts the search to the given handles. The depth of the search is by default infinite and can be restricted by <literal>findobj(searchHandles, '-depth', d, ...)</literal>. A value of 0 restricts the search to objects given in <literal>searchHandles</literal> and does not search within descendants, this is equivalent to the <literal>"flat"</literal> optional string.
78+
</para>
4479
</refsection>
4580
<refsection>
4681
<title>Examples</title>
4782
<programlisting role="example"><![CDATA[
4883
// Create a figure
49-
h=figure();
84+
h=scf();
5085
// Put a text in the figure
5186
uicontrol(h, "style","text", ...
5287
"string","This is a figure", ...
@@ -56,8 +91,26 @@ uicontrol(h, "style","text", ...
5691
// Find the object which "tag" value is "Alabel"
5792
lab=findobj("tag","Alabel");
5893
disp("The text of the label is """+lab.string+"""");
59-
// Close the figure
60-
close();
94+
]]></programlisting>
95+
<programlisting role="example"><![CDATA[
96+
// Create a figure
97+
h=scf();
98+
// plot something
99+
plot()
100+
xlabel abscissae
101+
ylabel ordinate
102+
title "a plot"
103+
legend "c1" "c2" "c3"
104+
105+
// Find the objects having a "font_size" property
106+
h1 = findobj("-property","font_size")
107+
// Change the font size of all text objects
108+
h1.font_size = 3
109+
110+
// Find the objects having a "thickness" property
111+
h2 = findobj("-property","thickness")
112+
// Change the thickness of such objects
113+
h2.thickness = 2
61114
]]></programlisting>
62115
</refsection>
63116
<refsection role="see also">

scilab/modules/gui/help/ja_JP/findobj.xml

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)