FXTreeList-App crashes

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 ?

···

--
Posted via http://www.ruby-forum.com/.

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

David Vallner

···

On Thu, 22 Feb 2007 13:15:13 +0100, Jörg Abelshauser <joerg.abelshauser@freenet.de> 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 ?

David Vallner 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 Vallner

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

···

On Thu, 22 Feb 2007 13:15:13 +0100, Jörg Abelshauser > <joerg.abelshauser@freenet.de> wrote:

--
Posted via http://www.ruby-forum.com/\.

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

···

On 2/22/07 7:25 AM, in article 3916481b8379225021f5ef5b336b98ef@ruby-forum.com, "Jörg Abelshauser" <joerg.abelshauser@freenet.de> wrote:

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

...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

···

--
Posted via http://www.ruby-forum.com/.

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

Jörg Abelshauser 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 ???

regards Joerg

This question is answered in the FAQ:

    Frequently Asked Questions

Hope this helps,

Lyle

···

On 2/23/07 2:47 AM, in article ae5a3301258fc4908dffd87db39b456d@ruby-forum.com, "Jörg Abelshauser" <joerg.abelshauser@freenet.de> 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 ???