-
2 weeks 2 days
-
2 weeks 4 days
-
4 weeks 2 days
-
4 weeks 5 days
-
4 weeks 6 days
Hello FXRuby
To illustrate how simple, clean and fun FXRuby is, Here's a sample Hello World:
require 'fox16'
include Fox
class HelloWindow < FXMainWindow
def initialize(app)
super(app, "Hello World!", :width => 200, :height => 100)
end
def create
super
show(PLACEMENT_SCREEN)
end
end
if __FILE__ == $0
FXApp.new do |app|
HelloWindow.new(app)
app.create
app.run
end
end
Now I know this is a bit overkill for a simple hello world but it actually looks elegant to me. What this does is it extends FXMainWindow widget and customize the create method by showing the form and centering it on the screen right after it is created.
The condition at the bottom checks if the file is being run as standalone. If it is, we pass a code block that creates a new instance of our class and away we go.

Facebook
Twitter
Post new comment