[fxruby-users] Beginner Q: can't get window to show in response to button press

Marlene Phillips marlene at phillipses.com
Wed Jun 24 02:22:09 EDT 2009


I'm trying to get text on to the screen in response to pressing a
button.  My puts command says that the window is shown, but it's not displayed.

require 'fox16'
include Fox

class Lookup < FXMainWindow
  def initialize(app)
    super(app, "Lookup window", :width=>400, :height=>600,:opts => DECOR_ALL|LAYOUT_FILL_X|LAYOUT_FILL_Y)
    bframe = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X)
    hearButton = FXButton.new(bframe, "Do you hear me?")
    yesWindow = FXHorizontalFrame.new(self, :opts => FRAME_GROOVE|LAYOUT_FILL_X)
    yesLabel = FXLabel.new(yesWindow,"Yes")
    yesWindow.hide
    puts "window shown? " + yesWindow.shown?.to_s #returns false
    hearButton.connect(SEL_COMMAND) do |sender,sel, data|
      yesWindow.show #NOT DISPLAYED. WHY?
      puts "pushed hear button"
      puts "window shown?" + yesWindow.shown?.to_s # returns true
    end
  end

  def create
    super
    show(PLACEMENT_SCREEN)
  end

end

if __FILE__ == $0
  FXApp.new do |app|
    Lookup.new(app)
    app.create
    app.run
  end
end

Sorry for the repost, I realized my title on the last one was not helpful.






More information about the fxruby-users mailing list