Prev | Current Page 95 | Next

David Berube

"Practical Reporting with Ruby and Rails"

You can also download and install it from
http://www.fox-toolkit.org/.
After you??™ve set up the prerequisites, you can try the simple example in FXRuby
shown in Listing 4-2.
Listing 4-2. Simple FXRuby Example (simple_fx_ruby_example.rb)
require 'fox16'
include Fox
myApp = FXApp.new
mainWindow=FXMainWindow.new(myApp, "Simple FXRuby Control Demo",
:padding =>10, :vSpacing=>10)
my_first_button= FXButton.new(mainWindow, 'Example Button Control')
my_first_button.connect(SEL_COMMAND) do
my_first_button.text="In a real-life situation, this would do something."
end
FXTextField.new(mainWindow, 30).text = 'Example Text Control'
FXRadioButton.new(mainWindow, "Example Radio Control")
FXCheckButton.new(mainWindow, "Example Check Control")
myApp.create
CHAPTER 4 n CREATING REPORTS ON THE DESKTOP 61
mainWindow.show( PLACEMENT_SCREEN )
myApp.run
You can run the example as follows:
ruby simple_fxruby_example.rb
Your application will look like Figure 4-2.
Figure 4-2. A simple FXRuby example
Let??™s take a look at the simple FXRuby demo in Listing 4-2.


Pages:
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
Michal fajna muza George Michael Hugh Masekela MIMS