Prev | Current Page 254 | Next

David Berube

"Practical Reporting with Ruby and Rails"

Then you call load_symbols_
from_server, which loads the symbols from the indicated XML server. Next, the code
begins to create user interface objects:
@fox_application=FXApp.new
@main_window=FXMainWindow.new(@fox_application, "Stock Ticker ",
nil, nil, DECOR_ALL | LAYOUT_EXPLICIT)
@tickerlabel = FXLabel.new(@main_window, get_label_text,
nil, 0, LAYOUT_EXPLICIT)
@tickerlabel.font.setFont "helvetica [bitstream],#{font_size}"
The first line creates an FXApp object, which is a FOX object that represents the entire
application and handles application-wide tasks, such as setting timers. The second line
creates a window object, which represents your only window. After that, the code creates
the single control in your window, which is a label that occupies the entire window. The
call to get_label_text returns a label with all of the stock names and prices.
Next, you create a timer that automatically scrolls the ticker every 50 milliseconds:
def scroll_timer(sender, sel, ptr)
self.scroll_label
@fox_application.


Pages:
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
ABBA pupa make up 2 1 Athlete ATB