Re: fxRuby: changing icon in TreeItem crashes


#1

Christer,

You have to explicitly call “create” for the new icon to
create the server side object. Fox does it automatically
for all the objects it can see at the time “create” is
called for the FXApp object if I remember correctly.

begin

doc = makeIcon(“minidoc.png”)

doc.create

@tree.currentItem.text = “new icon coming …”
@tree.currentItem.closedIcon = doc # crash!

I had no problem adding icons when the TreeItem was constructed.

I’m using fox14.

Christer

Yura.


#2

Thanks Yura, this solved my problem!

Do I have to destroy or delete also, to balance create?

Christer

Kloubakov Yura wrote:

Christer,

You have to explicitly call “create” for the new icon to
create the server side object. Fox does it automatically
for all the objects it can see at the time “create” is
called for the FXApp object if I remember correctly.

begin

doc = makeIcon(“minidoc.png”)

doc.create

@tree.currentItem.text = “new icon coming …”
@tree.currentItem.closedIcon = doc # crash!

I had no problem adding icons when the TreeItem was constructed.

I’m using fox14.

Christer

Yura.


#3

On 4/7/06, Christer N. removed_email_address@domain.invalid wrote:

Do I have to destroy or delete also, to balance create?

No, the icon’s resources will be destroyed automatically when it’s
garbage-collected.