Sha256: 0a14b6e270fcecd5028d9fc6592575a863be5c176d0e02e3787ed347e7d18b41

Contents?: true

Size: 1.63 KB

Versions: 14

Compression:

Stored size: 1.63 KB

Contents

#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
  require 'rubygems' 
rescue LoadError
end
require 'wx'



class TestPanel < Wx::Panel
  attr_reader :lb
  def initialize(parent, log)
    super parent
    @log = log
    
    sample_list = %w|one two three four five six seven eight
                     nine ten eleven twelve thirteen fourteen|
    
    self.sizer = Wx::VBoxSizer.new
    tx = Wx::StaticText.new( self, 
                             :label => "This example uses the wxCheckListBox control.")
    sizer.add(tx, 0, Wx::ALL, 5)
    @lb = Wx::CheckListBox.new(self, :choices => sample_list)
    sizer.add(lb, 1, Wx::ALL|Wx::GROW, 5)
    evt_listbox lb, :on_evt_listbox
    evt_listbox_dclick lb, :on_evt_listbox_dclick
    lb.set_selection(0)
    

    btn = Wx::Button.new(self, :label => "Test SetString")
    sizer.add(btn, 0, Wx::ALL, 5)
    evt_button btn, :on_test_button
  end
  
  def on_evt_listbox(event)
    @log.write_text("evt_listbox: " + event.get_string)
  end
  
  def on_evt_listbox_dclick(event)
    @log.write_text("evt_listbox_dclick:")
  end
  
  def on_test_button(event)
    @lb.set_string(4, "FUBAR")
  end
end

module Demo
  def Demo.run(frame, nb, log)
    win = TestPanel.new(nb, log)
    return win
  end
  
  def Demo.overview
    return "A checklistbox is like a listbox, but allows items to be checked or unchecked."
  end
end

if __FILE__ == $0
  run_solo_lib = File.join( File.dirname(__FILE__), 'run.rb')
  load run_solo_lib
  run File.basename($0)
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
wxruby3-0.9.2-x64-mingw-ucrt samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.1-x64-mingw-ucrt samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.0-x64-mingw-ucrt samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.0.pre.rc.2-x64-mingw-ucrt samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.0.pre.rc.1-x64-mingw-ucrt samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.0.pre.beta.14-x64-mingw-ucrt samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.0.pre.beta.13-x64-mingw-ucrt samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.0.pre.beta.11-x64-mingw-ucrt samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.0.pre.beta.10-x64-mingw-ucrt samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.0.pre.beta.9-x64-mingw-ucrt samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.0.pre.beta.8-x64-mingw-ucrt samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.0.pre.beta.2-x64-mingw-ucrt-3.2-3.2.2 samples/bigdemo/wxCheckListBox.rbw
wxruby3-0.9.0.pre.beta.1-x64-mingw-ucrt-3.2 samples/bigdemo/wxCheckListBox.rbw