Hi everyone I''m afraid I posted here: http://www.ruby-forum.com/topic/199028 ..before seeing that that forum looks almost totally dead. Should one of these forums not be shut down to save people some time and false hopes? :-) So I''m going to repost here and reply there to close the topic, thus, hopefully remaining a good netizen. Here is my question: I am trying to listen for the FXTopWindow events SEL_CLOSE, SEL_MINIMIZE, SEL_MAXIMIZE, SEL_RESTORE because I want to execute some code when a person presses the X button to close the window, etc. None of my code gets executed though. Can anyone help? class TextDialog def initialize(parent) construct_widget_tree(parent) init if respond_to? ''init'' end def construct_widget_tree(parent) @topwin = FXMainWindow.new(parent, ''title'') @topwin.width = 300 @topwin.height = 200 end attr_reader :topwin end if __FILE__==$0 require ''fox16'' include Fox app=FXApp.new w=TextDialog.new(app) w.topwin.connect(SEL_CLOSE) { app.exit } w.topwin.connect(SEL_MINIMIZE) { puts "MIN" } w.topwin.connect(SEL_MAXIMIZE) { puts "MAX" } w.topwin.connect(SEL_RESTORE) { puts "RESTORE" } w.topwin.show app.create app.run end
As posted here: http://old.nabble.com/programmatically-%22pushing%22-a-button-td14403676.html It appears that when a user selects Maximize or Minimize it actually sends SEL_CONFIGURE. Hope that helps. On Wed, Nov 11, 2009 at 3:16 PM, Leslie Viljoen <leslieviljoen at gmail.com>wrote:> Hi everyone > > I''m afraid I posted here: > http://www.ruby-forum.com/topic/199028 > ..before seeing that that forum looks almost totally dead. Should one > of these forums not be shut down to save people some time and false > hopes? :-) > > So I''m going to repost here and reply there to close the topic, thus, > hopefully remaining a good netizen. > > Here is my question: > > > I am trying to listen for the FXTopWindow events SEL_CLOSE, > SEL_MINIMIZE, SEL_MAXIMIZE, SEL_RESTORE because I want to execute some > code when a person presses the X button to close the window, etc. > > None of my code gets executed though. Can anyone help? > > class TextDialog > def initialize(parent) > construct_widget_tree(parent) > init if respond_to? ''init'' > end > > def construct_widget_tree(parent) > @topwin = FXMainWindow.new(parent, ''title'') > @topwin.width = 300 > @topwin.height = 200 > end > > attr_reader :topwin > end > > if __FILE__==$0 > require ''fox16'' > include Fox > > app=FXApp.new > w=TextDialog.new(app) > > w.topwin.connect(SEL_CLOSE) { app.exit } > w.topwin.connect(SEL_MINIMIZE) { puts "MIN" } > w.topwin.connect(SEL_MAXIMIZE) { puts "MAX" } > w.topwin.connect(SEL_RESTORE) { puts "RESTORE" } > > w.topwin.show > app.create > app.run > end > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users >-- If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or other use of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20091111/5549aded/attachment.html>
On Wed, Nov 11, 2009 at 2:16 PM, Leslie Viljoen <leslieviljoen at gmail.com> wrote:> I''m afraid I posted here: > http://www.ruby-forum.com/topic/199028 > ..before seeing that that forum looks almost totally dead. Should one > of these forums not be shut down to save people some time and false > hopes? ?:-)I agree with you, but it''s not my forum to shut down. :) I don''t have the bandwidth to monitor the Internet for all of these little discussion pockets. This mailing list has always been (and continues to be) the place for FXRuby chatter.> So I''m going to repost here and reply there to close the topic, thus, > hopefully remaining a good netizen.Thanks. ;)> Here is my question: > > I am trying to listen for the FXTopWindow events SEL_CLOSE, > SEL_MINIMIZE, SEL_MAXIMIZE, SEL_RESTORE because I want to execute some > code when a person presses the X button to close the window, etc. > > None of my code gets executed though. Can anyone help?Per the message found by Joey Kinsella (elsewhere in this thread) it sounds like the documentation for FXTopWindow needs to be corrected to reflect the fact that you only get SEL_MINIMIZE, SEL_MAXIMIZE, SEL_RESTORE and SEL_CLOSE when you call one of those FXTopWindow methods (e.g. FXTopWindow#maximize); otherwise you just get SEL_CONFIGURE. I''m not sure why the documentation wasn''t corrected when that problem was originally reported. Leslie, could you please file a bug report on this on the new bug tracker at Lighthouse? http://fxruby.lighthouseapp.com/projects/40125-fxruby Thanks, Lyle