You retrieve them using the final
['symbol'] reference.
CHAPTER 9 n INVESTMENT TRACKING WITH FIDELITY 185
Next, the scroll_label method scrolls the ticker label containing the stock symbols
and prices across the screen:
def scroll_label
if(@tickerlabel.x < -@tickerlabel.width)
@tickerlabel.move(@main_window.width , @tickerlabel.y)
else
@tickerlabel.move(@tickerlabel.x - 3, @tickerlabel.y)
end
end
This function scrolls the label from right to left. Once the ticker has completely
scrolled off the left edge, the function resets it back to the right side of the screen. The
3-pixel-per-call move is arbitrary, so feel free to change that amount if you would like a
faster or slower ticker. You can also change the frequency of the timer call in the
initialize function, which would result in the scroll_label function being called less
often. However, if the function is called too infrequently, the scrolling motion will be
jerky.
The ticker will scroll completely off the screen before being reset to the right side of
the screen.
Pages:
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269