Prev | Current Page 110 | Next

David Berube

"Practical Reporting with Ruby and Rails"


CHAPTER 4 n CREATING REPORTS ON THE DESKTOP 71
Next, you need to create a place for the graphs to be displayed:
@graph_picture_viewer = FXImageView.new(main_window , nil, nil, 0,
LAYOUT_FILL_X | LAYOUT_FILL_Y)
@graph_picture_viewer.connect( SEL_CONFIGURE ) do
update_display
end
The first line creates an FXImageView object, which you will use to display the graphs.
Note the use of the LAYOUT_FILL_X and LAYOUT_FILL_Y flags, which mean that the graph
viewer will use all available space in the window.
Finally, outside your class, you need to actually display your window and let it run.
The following three lines do just that:
FXApp.instance().create
main_window.show( PLACEMENT_SCREEN )
FXApp.instance().run
The first line creates the necessary objects, which are specific to the operating system
(and, happily, the details are hidden from us). The second line displays your window on
the screen, and the PLACEMENT_SCREEN flag means it will be centered. A call to FXApp.
instance() returns your previously defined FXApp object, since FXApp is a singleton.


Pages:
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
Mario kreskowka Miami Sound Machine Maanam Maciej Maleńczuk