require 'fox16'
include Fox

class ListHandlerWindow < FXMainWindow
  def initialize(app)
    # Invoke base class initialize first
    super(app, "List Handler", nil, nil,
          DECOR_TITLE | DECOR_CLOSE)
    @list = FXList.new(self, nil, 0,
                       LIST_BROWSESELECT |
                       LAYOUT_FILL_X)

    @list.connect(SEL_COMMAND) do |sender, sel, pos|
  puts pos.to_s + " => " + @names[pos]
end
    @names = ["Chuck", "Sally", "Franklin",
              "Schroeder", "Woodstock",
              "Matz", "Lucy"]
    @names.each { |name| @list << name }
  end
end

application = FXApp.new
main = ListHandlerWindow.new(application)
application.create
main.show(PLACEMENT_SCREEN)
application.run

