From: Jason Persampieri Date: 2002-12-17T10:17:51+09:00 Subject: Re: More FXRuby oddness : subclassed FXTreeItem not to mention.... when you run this sample with Ruby 1.7.3 (but not with 1.6.7), it crashes as soon as you click on the item, then move the mouse... bug.rb:22:in `getItemAt': undefined method `getWidth' for nil (NoMethodError) from bug.rb:22:in `run' from bug.rb:22 Jason hehe... this is what I get for using a programming language in development with a window manager in development ;) --- Jason Persampieri wrote: > Ahhh... always one step ahead of me, aren't ya? > > Here's a test case > > require 'fox' > include Fox > > class MyTreeItem < FXTreeItem > end > > class MyMainWindow < FXMainWindow > def initialize(app) > super(app, "Era - The Kush Build System", nil, > nil, DECOR_ALL, 0, 0, 200, 200) > tree = FXTreeList.new(self, 0, nil, 0, > LAYOUT_FILL_X|LAYOUT_FILL_Y) > tree.addItemLast(nil, MyTreeItem.new("NewItem")) > tree.connect(SEL_COMMAND) {|sender, sel, item| > puts item.class.to_s} > end > end > > theApp = FXApp.new > theApp.init(ARGV) > > myWindow = MyMainWindow.new(theApp) > theApp.create > myWindow.show(PLACEMENT_SCREEN) > theApp.run > > > --- Lyle Johnson wrote: > > Jason Persampieri wrote: > > > > > I have subclassed FXTreeItem (MyTreeItem) and > > built a > > > tree out of it. That works fine. > > > > > > However, when 'connecting' a SEL_COMMAND sent to > > the > > > tree to a method, the item that is sent is an > > > FXTreeItem, and not a MyTreeItem. Is this the > > > intended behaviour? > > > > No, you should get a reference to the original > > MyTreeItem object(s). > > This *sounds* like a bug that has already been > fixed > > for the (pending) > > FXRuby-1.0.17 release; if you want to send me a > test > > case to > > double-check, I'd be glad to confirm that it's > doing > > the right thing > > before the official 1.0.17 release. > > > > > >