Prev | Current Page 255 | Next

David Berube

"Practical Reporting with Ruby and Rails"

addTimeout(50, method(:scroll_timer))
end
@fox_application.addTimeout(50, method(:scroll_timer))
The addTimeout method will call the scroll_timer method after 50 milliseconds. Note
that this doesn??™t recur, so you need to add a new timeout after each execution of the
method. You call the method function to get a Method object to use with the scroll_timer
method. The method function takes a symbol and returns a Method object representing the
method with that symbol name.
The actual scrolling of the label from right to left is done by the scroll_label class
method defined later in the class. This is in order to separate the code that manages the
timer from the code that scrolls the label.
Next, you set up one more timer, which will update the text of the label once a
minute:
CHAPTER 9 n INVESTMENT TRACKING WITH FIDELITY 184
def update_label_timer(sender, sel, ptr)
@tickerlabel.text = self.get_label_text
@fox_application.addTimeout(1000*60*@quote_frequency,
method(:update_label_timer))
end
@fox_application.


Pages:
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
Robert Miles meble Men At Work Ludacris Monty Python