# FXTreeList-App crashes

**URL:** <https://www.ruby-forum.com/t/fxtreelist-app-crashes/86455>\
**Category:** Ruby\
**Created:** [February 22, 2007, 1:15pm UTC](https://www.ruby-forum.com/t/fxtreelist-app-crashes/86455 "2007-02-22T13:15:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jabe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/db5fbb/32.png) [@jabe](https://www.ruby-forum.com/u/jabe)\
**Post date:** [February 22, 2007, 1:15pm UTC](https://www.ruby-forum.com/t/fxtreelist-app-crashes/86455/1 "2007-02-22T13:15:10Z")

</div>

My FX-Application crashes, when I update an FXTreeItem-Icon in an  
FXTreeList (setopenIcon / setClosedIcon) with an event-method  
(right-mouse-click).  
Does anybody have an idea ?

---

<div class="post-metadata">

**Author:** ![jabe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/db5fbb/32.png) [@jabe](https://www.ruby-forum.com/u/jabe)\
**Post date:** [February 22, 2007, 2:08pm UTC](https://www.ruby-forum.com/t/fxtreelist-app-crashes/86455/2 "2007-02-22T14:08:29Z")

</div>

On Thu, 22 Feb 2007 13:15:13 +0100, JÃ¶rg Abelshauser  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> My FX-Application crashes, when I update an FXTreeItem-Icon in an  
> FXTreeList (setopenIcon / setClosedIcon) with an event-method  
> (right-mouse-click).  
> Does anybody have an idea ?

Run it with regular ruby.exe instead of rubyw.exe (if on Windows) to get  
some details about the crash?

David V.

---

<div class="post-metadata">

**Author:** ![jabe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/db5fbb/32.png) [@jabe](https://www.ruby-forum.com/u/jabe)\
**Post date:** [February 22, 2007, 2:25pm UTC](https://www.ruby-forum.com/t/fxtreelist-app-crashes/86455/3 "2007-02-22T14:25:03Z")

</div>

David V. wrote:

> On Thu, 22 Feb 2007 13:15:13 +0100, JÃ¶rg Abelshauser  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > My FX-Application crashes, when I update an FXTreeItem-Icon in an  
> > FXTreeList (setopenIcon / setClosedIcon) with an event-method  
> > (right-mouse-click).  
> > Does anybody have an idea ?
> 
> Run it with regular ruby.exe instead of rubyw.exe (if on Windows) to get  
> some details about the crash?
> 
> David V.

not really helpful:  
FxGui.rb:547: [BUG] Segmentation fault  
ruby 1.8.2 (2004-12-25) [i386-mswin32]

This application has requested the Runtime to terminate it in an unusual  
way.  
Please contact the application’s support team for more information.

Further, here is the code-snippet, which is called when  
right-mouse-click at an tree-item:

```
item = @tree.getFirstItem

if @toggle != 8
    @tree.setItemText(item, "Bla")
    icon = makeIcon("testnode.ico")
    @tree.setItemClosedIcon(item, icon)
    @toggle = 8
else
    @tree.setItemText(item, "Boing")
    icon = makeIcon("testnode.ico")
    @tree.setItemClosedIcon(item, icon)
    @toggle = 7
end

```

regards JÃ¶rg

---

<div class="post-metadata">

**Author:** ![jabe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/db5fbb/32.png) [@jabe](https://www.ruby-forum.com/u/jabe)\
**Post date:** [February 23, 2007, 9:47am UTC](https://www.ruby-forum.com/t/fxtreelist-app-crashes/86455/4 "2007-02-23T09:47:37Z")

</div>

…has helped ! Thanks a lot!  
but it’s not obvious from the docs. Whats’s the difference between the  
constructor and the create-method, the 1st icon , which i commit to the  
item doesn’t need the create-method ???

regards Joerg

---

<div class="post-metadata">

**Author:** ![jabe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/db5fbb/32.png) [@jabe](https://www.ruby-forum.com/u/jabe)\
**Post date:** [February 22, 2007, 6:33pm UTC](https://www.ruby-forum.com/t/fxtreelist-app-crashes/86455/5 "2007-02-22T18:33:25Z")

</div>

On 2/22/07 7:25 AM, in article  
removed\_email\_address@domain.invalid, “Jörg Abelshauser”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> else
> @tree.setItemText(item, "Boing")
> icon = makeIcon("testnode.ico")
> @tree.setItemClosedIcon(item, icon)
> @toggle = 7
> end
> 
> ```

You need to call create() on the icon after you construct it, e.g.

```
icon = makeIcon("testnode.ico")
icon.create
@tree.setItemClosedIcon(item, icon)

```

Hope this helps,

Lyle

---

<div class="post-metadata">

**Author:** ![jabe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/db5fbb/32.png) [@jabe](https://www.ruby-forum.com/u/jabe)\
**Post date:** [February 23, 2007, 10:12am UTC](https://www.ruby-forum.com/t/fxtreelist-app-crashes/86455/6 "2007-02-23T10:12:58Z")

</div>

When you initially create the application, all children of the app are  
created automatically.  
If you add any new children after the initial App.create and you attempt  
to access/display them, they have to be created, which you have to do  
manually. I made this mistake before too.

Raj

---

<div class="post-metadata">

**Author:** ![jabe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/db5fbb/32.png) [@jabe](https://www.ruby-forum.com/u/jabe)\
**Post date:** [February 23, 2007, 5:05pm UTC](https://www.ruby-forum.com/t/fxtreelist-app-crashes/86455/7 "2007-02-23T17:05:11Z")

</div>

On 2/23/07 2:47 AM, in article  
removed\_email\_address@domain.invalid, “Jörg Abelshauser”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> …has helped ! Thanks a lot!
> 
> but it’s not obvious from the docs. Whats’s the difference between the  
> constructor and the create-method, the 1st icon , which i commit to the  
> item doesn’t need the create-method ???

This question is answered in the FAQ:

```
http://www.fox-toolkit.org/faq.html#ILLEGALICON

```

Hope this helps,

Lyle
