From: Tom Sawyer Date: 2002-07-25T10:13:31+09:00 Subject: Re: FXRuby without the subclassing On Wed, 2002-07-24 at 17:48, Lyle Johnson wrote: > myButton = FXButton.new(parent, "Click Me!") > myButton.connect(SEL_COMMAND) { puts "Call me Ishmael" } thanks, that worked! this not at all how the examples i've seen do it, but this is much better, much more intuitive. thanks Ishmael! ;-) strange though: class RadioBox_Fox < RadioBox attr_reader :engine_widget def initialize(engine, attributes={}) super @engine_widget = FXGroupBox.new(@engine.false_parent, '', LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0) items.each do |item| fxrb = FXRadioButton.new(@engine_widget, item, nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP) fxrb.connect(SEL_COMMAND) { if fxrb.getCheck @value = fxrb.to_s self.value=fxrb.to_s # why do i have to use self here? event_change # i don't here! end } end end end # RadioBox why do i need to use self to get to the class' (actually the instance of the class') #value= method? also notice i had to set @value explicity. that's b/c #value= is dynamically defined with class_eval { define_method(...) } in which i haven't yet figured out to use #super so it is in the context of the class and not the object the class_eval is called from. thanks again, ~transami