Better living through buttons

Obviously, we need to add a few things to make it more interesting. Let's start by putting a button inside the main window. The FXButton class provides a standard push-button widget:

require 'fox14'

include Fox

theApp = FXApp.new

theMainWindow = FXMainWindow.new(theApp, "Hello")
FXButton.new(theMainWindow, "Hello, World!")
theApp.create

theMainWindow.show

theApp.run

As you might guess, passing theMainWindow as the first argument to FXButton.new tells FXRuby that the new button is a child of the main window. The second argument to FXButton.new is a string that will be displayed on the button. If you run the program now, you should see this: