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 'fox16'

include Fox

theApp =

theMainWindow =, "Hello"), "Hello, World!")

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