[Scilab-users] Dot operator on a handle
Stefan Du Rietz
sdr at durietz.se
Sun Sep 29 11:37:06 CEST 2013
Error setting a property of a graphics entity with the dot operator on
a handle from a calling function
Save these two functions in a file testhandle.sci:
function testhandle(nodot, h_arg)
if ~exists('nodot') then
nodot = %f;
end
if ~exists('h_arg') then
h_arg = %f;
end
f = scf();
a = f.children;
a.user_data = 1;
if h_arg then
testhandle2(nodot, a)
else
testhandle2(nodot)
end
endfunction
function testhandle2(nodot, a)
disp("type(a) = " + string(type(a)))
//pause
if nodot then
set(a,"user_data",2);
else
a.user_data = 2;
end
disp("type(a) = " + string(type(a)))
delete(f)
endfunction
Load it and and then run it:
-->testhandle(%f)
type(a) = 9
type(a) = 17
-->testhandle(%t)
type(a) = 9
type(a) = 9
That is, if you use use the dot operator on a handle from a calling
function to set a property of a graphics entity, like here (the first
case)
a.user_data = 2;
the handle (type 9) is changed to an mlist (type 17) but if you change
the property with the set routine (the second case)
set(a,"user_data",2);
the handle is kept. It also works with the dot operator if you send
the handle as an argument to testhandle2 (see the code above):
-->testhandle(%f, %t)
or
-->testhandle(h_arg=%t)
type(a) = 9
type(a) = 9
Is this a known bug or shall I report a new one?
Regards
Stefan
More information about the users
mailing list