Prev | Current Page 108 | Next

David Berube

"Practical Reporting with Ruby and Rails"


(If you??™re interested, you can find out more at http://www.fxruby.org/doc/events.
html.) The fourth parameter, COMBOBOX_STATIC | FRAME_SUNKEN, is a bit field consisting of
various style bits. Specifically, it??™s two constants OR??™d together: the COMBOBOX_STATIC
constant makes the box static, so that users must pick from the list, and the
FRAME_SUNKEN constant makes the box have a three-dimensional sunken effect.
Additionally, the numVisible attribute selects how many options are visible in the
drop-down list at one time. Here, you set numVisible to 5 to let the user see all of the
available elements without scrolling.
Next, you fill the FXComboBox with options:
Game.find(:all).each do |game|
@game_combobox.appendItem(game.name, game.id)
end
This loop calls appendItem for each game in the database. The first parameter to the
appendItem method is the text that represents the option in the drop-down list. The second
parameter is the value the item has, which is stored in the itemData array in the
@game_combobox object.


Pages:
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120