Prev | Current Page 96 | Next

David Berube

"Practical Reporting with Ruby and Rails"


Dissecting the Code
Listing 4-2 begins by creating an FXApp object, which represents your application, and
then an FXMainWindow object, which holds all of the controls. The FXApp object handles
application-wide tasks, like updating the mouse cursor and so forth.
myApp = FXApp.new
mainWindow=FXMainWindow.new(myApp, "Simple FXRuby Control Demo",
:padding =>10, :vSpacing=>10)
Here, you set a couple properties. The padding property is set to 10, which gives 10 pixels
of space on each side. The vSpacing property is also set to 10, for 10 pixels between each
control. Taken together, these two properties make the controls evenly spaced out so that
the application is visually attractive. By default, controls are arranged top to bottom;
however, you can specify other arrangements, as you??™ll see in the next section.
After your FXApp and FXMainWindow objects are created, you can add your first control:
my_first_button= FXButton.new(mainWindow, 'Example Button Control')
my_first_button.connect(SEL_COMMAND) do
puts "You've clicked the button!"
end
CHAPTER 4 n CREATING REPORTS ON THE DESKTOP 62
2ca983ba3745582e6151dc1b079b2db0
This is an FXButton control, which is designed to allow users to perform a specific
action.


Pages:
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
Władysławowo noclegi pity pozycjonowanie bilety lotnicze świnoujście noclegi