From: Patrick Date: 2002-04-10T10:31:15+09:00 Subject: FXRuby: subwindows Hello! I'm using Ruby 1.6.6 and FXRuby I'm trying to write a very small appplication: - the main window has an FXLabel, and an FXButton: "click" - when "click" il clicked, the application opens a subwindow, whitch contains 4 buttons "1", "2", "3", "4" - when one of theese buttons is choosed, the subwindow returns some value to the main window - the main window updates the FXLabel.text to show whitch button was pressed. Problem 1: 1) I've read that the main window is derived from FXMainWindow, but the other windows are derived from such classes like FXDialogBox or FXTopWindow 2) FXDialogBow returns only true or false, and I don't want to use global variables to handle the result in the sub window 3) FXTopLevel doesn't support .new nor .show methods 4) I'm not sure about the syntax used to return the result Problem 2: I've tryed to use a FXPopup instead of the subwindow, whitch contained 4 FXOptions instead of 4 buttons. I don't know how to: - show this FXPopup when "click" is clicked - return the result Please could you explain what's wrong? Thank you in advance. -------------------------------------- My application code -------------------- require "fox" include Fox class MainWindow < FXMainWindow def initialize(app) super(app, "Test!!!") vf=FXVerticalFrame.new(self,LAYOUT_FILL_X|LAYOUT_FILL_Y) # @lbl=FXLabel.new(vf, "Before 'click'", nil, LAYOUT_FILL_X|FRAME_THICK) btn=FXButton.new(vf, "Click", nil, nil, 0, FRAME_THICK|FRAME_RAISED) # btn.connect(SEL_COMMAND) { |sender, sel, event| @res=SubWindow.new(app) #???????????????????? no .new, no .show @lbl.text=@res.to_s } end def create super show(PLACEMENT_SCREEN) end end class SubWindow < FXTopWindow def initialize(app) hf=FXHorizontalFrame.new(self) FXButton.new(@bh, "1").connect(SEL_COMMAND) { return 1 } #???????????????????? FXButton.new(@bh, "2").connect(SEL_COMMAND) { return 2 } FXButton.new(@bh, "3").connect(SEL_COMMAND) { return 3 } FXButton.new(@bh, "4").connect(SEL_COMMAND) { return 4 } end def create super show(PLACEMENT_SCREEN) end end a=FXApp.new("Test","Test") a.init(ARGV) MainWindow.new(a) a.create a.run