#!ruby # -*- mode: ruby; coding: utf-8 -*- # Last updated: <2018/02/27 06:26:46 +0900> # # FXRuby Hello World require "fox16" include Fox class MyHello < FXMainWindow def initialize(app, title = "Hello World FXRuby") # main is window class mw = super(app, title, :width => 320, :height => 240) # create layout pack = FXPacker.new(mw) # create label lbl = FXLabel.new(pack, "Hello World !") # create button btn = FXButton.new(pack, "Click !") # set button push event btn.connect(SEL_COMMAND) do |sender, sel, data| # show message box msg = FXMessageBox.new(btn, "Message", "Hello World in FXRuby", :opts => MBOX_OK) msg.execute end end def create super show(PLACEMENT_SCREEN) end end if __FILE__ == $0 FXApp.new do |app| mw = MyHello.new(app) app.create app.run end end