Strange handle behavior (was Re: [Changeset]: Re: cla() ?)
Ben Abbott
bpabbott at mac.com
Tue Oct 7 21:06:09 CDT 2008
On Oct 7, 2008, at 5:43 PM, Ben Abbott wrote:
>
> On Oct 7, 2008, at 9:10 AM, Michael Goffioul wrote:
>
>> While we're talking about __go_delete__, does anybody
>> remember what was the idea behind removing an object
>> from its parent's children in __go_delete__, instead of
>> gh_manager::free? This makes life slighlty more complex
>> if you want to delete an object from C++, where you would
>> typically use gh_manager::free, but you then have to remove
>> the child manually from its parent's children.
>>
>> I don't think I wrote that part of the code, and I can't figure
>> out why it is written that way.
>>
>> Michael.
>
> MIght what describe be responsible for why the code below does not
> return the axis limits to its default values?
>
> octave:21> figure(1)
> octave:22> clf
> octave:23> axis
> ans =
>
> 0 1 0 1 0 1
>
> octave:24> plot(1:10)
> octave:25> text(5,5,'some text')
> octave:26> axis
> ans =
>
> 0 10 0 10 -1 1
>
> octave:27> delete (get(gca,'children'))
> octave:28> axis auto
> octave:29> axis
> ans =
>
> 0 10 0 10 -1 1
>
Some more strange behavior. I wrote a trivial script called
"test_delete.m", which contains the lines below.
----------------------
clear all
figure (1)
clf
plot (1:10)
hc = get (gca, 'children');
delete (hc)
axis auto
p = get (hc)
----------------------
When I run it I get ...
octave:30> test_delete
error: get: invalid handle (= -6.17358)
error: called from:
error: /Users/bpabbott/Development/Octave Toolbox/cla/test_cla.m at
line -1, column -1
With the exception of the x/y limits not changing, everything looks
ok. However, if I then manually type the last line ...
octave:30> p = get(hc)
p =
{
beingdeleted = off
busyaction = queue
buttondownfcn = [](0x0)
children = [](0x0)
clipping = on
createfcn = [](0x0)
deletefcn = [](0x0)
handlevisibility = on
hittest = on
interruptible = on
parent = -7.3210
selected = off
selectionhighlight = on
tag =
type = text
userdata = [](0x0)
visible = on
__modified__ = on
uicontextmenu = [](0x0)
string =
units = data
position =
0 0 0
rotation = 0
horizontalalignment = left
color =
0 0 0
fontname = Helvetica
fontsize = 10
fontangle = normal
fontweight = normal
interpreter = tex
backgroundcolor = none
displayname =
edgecolor = none
erasemode = normal
editing = off
fontunits = points
linestyle = -
linewidth = 0.50000
margin = 1
verticalalignment = middle
}
If I manually type each line then all appears to work as expected.
I have no idea what is happening here, but thought the example might
help someone else track down the problem.
Ben
More information about the Octave-maintainers
mailing list