trying to create a list control, filling with data, but it wont scroll
vertically or respond to mouse click.
require ‘rubygems’
require ‘wx’
include Wx
class MyFrame < Wx::Frame
def initialize()
super(nil,-1,‘Wristband Manager’,:size => [300,400])
@my_panel = Panel.new(self)
show()
end
end
class MasterList < Wx::ListCtrl
def initialize(parent)
super(parent,:size => [250,200],:style => Wx::LC_REPORT)
create_layout
add_entries
end
def create_layout
self.insert_column(0, “Name”)
self.insert_column(1, “Courses”)
self.insert_column(2, “Band”)
self.set_column_width(0,100)
self.set_column_width(1,25)
self.set_column_width(2,50)
end
def add_entries
name = ‘Test01’
50.times do |idx|
item0 = Wx::ListItem.new
item0.set_text(name)
item0.set_column(0)
item0.set_id(idx)
self.insert_item(item0)
item1 = Wx::ListItem.new
item1.set_text("15")
item1.set_column(1)
item1.set_id(idx)
self.set_item(item1)
item1 = Wx::ListItem.new
item1.set_text("Green")
item1.set_column(2)
item1.set_id(idx)
self.set_item(item1)
name.succ!
end
end
end
class MyApp < App
def on_init
frame1 = MyFrame.new
MasterList.new frame1
end
end
MyApp.new.main_loop()