From: "SHULTZ,BARRY (HP-Israel,ex1)" Date: 2001-04-21T23:45:00+09:00 Subject: [ruby-talk:13982] RE: FXRuby and registering callbacks Answering my own post. I found lots of examples in the latest tarball. Regards, Barry > -----Original Message----- > From: SHULTZ,BARRY (HP-Israel,ex1) [mailto:barry_shultz@hp.com] > Sent: Saturday, April 21, 2001 9:00 AM > To: ruby-talk@ruby-lang.org > Subject: [ruby-talk:13960] FXRuby and registering callbacks > > > Hi, > Could someone tell me the right way to register > a callback in FXRuby? Below you'll find a code > example that is full of mistakes. I would like to > know how to correct it,why didClick is called > when FoxTest.new is called, and why the app ends > when the button is clicked ( maybe these are all > the same question :0) ) > > Any help/good examples would be _really_ > appreciated. There was one example I saw in > blade, but I couldn't make it work. > > Regards, > Barry > ****************************************** > require "fox" > > include Fox > > > class FoxTest > attr_reader :btn, :main > > def initialize() > application = FXApp.new("Test1", "Test1") > application.init(ARGV) > main = FXMainWindow.new(application, "First FXRuby", nil, nil, > DECOR_ALL) > > btn = FXButton.new(main, "Button1", nil, application) > > > btn.onDefault(btn,FXButton::SEL_CLICKED,self.didClick) > > application.create() > main.show(PLACEMENT_SCREEN) > application.run() > end > > def didClick() > puts "clicked me " > end > > end > > FoxTest.new > >