Sha256: 0f813eb3d8ceaa49f398e99856a9a8de2d883310c0620d10df75985bbfef79f9

Contents?: true

Size: 1.37 KB

Versions: 12

Compression:

Stored size: 1.37 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 TestChoice < Wx::Panel
    def initialize(parent, log)
        @log = log
        super(parent, -1)
        
        sampleList = %w(one two three four five six seven eight)
        
        Wx::StaticText.new(self, -1, "This example uses the wxChoice control.", Wx::Point.new(15,10))
        
        Wx::StaticText.new(self, -1, "Select one:", Wx::Point.new(15,50), Wx::Size.new(65,20))
        @ch = Wx::Choice.new(self, 40, Wx::Point.new(80,50), Wx::DEFAULT_SIZE, sampleList)
        evt_choice(40) {|event| on_evt_choice(event)}
    end
    
    def on_evt_choice(event)
        @log.write_text("evt_choice: " + event.get_string())
        @ch.append("A new item")
    end
end

module Demo
    def Demo.run(frame, nb, log)
        win = TestChoice.new(nb, log)
        return win
    end
    
    def Demo.overview
        return "A choice item is used to select one of a list of strings. Unlike a listbox, only the selection is visible until the user pulls down the menu of choices."
    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

12 entries across 12 versions & 2 rubygems

Version Path
wxruby64-2.0.1-x64-mingw32 samples/bigdemo/wxChoice.rbw
wxruby-2.0.1-x86-mswin32-60 samples/bigdemo/wxChoice.rbw
wxruby-1.9.7-i386-mswin32 samples/bigdemo/wxChoice.rbw
wxruby-1.9.10-x86-mswin32-60 samples/bigdemo/wxChoice.rbw
wxruby-1.9.6-x86-mswin32-60 samples/bigdemo/wxChoice.rbw
wxruby-1.9.6-x86-mingw32 samples/bigdemo/wxChoice.rbw
wxruby-1.9.7-x86-mswin32-60 samples/bigdemo/wxChoice.rbw
wxruby-1.9.8-x86-mingw32 samples/bigdemo/wxChoice.rbw
wxruby-1.9.8-x86-mswin32-60 samples/bigdemo/wxChoice.rbw
wxruby-1.9.9-x86-mingw32 samples/bigdemo/wxChoice.rbw
wxruby-1.9.9-x86-mswin32-60 samples/bigdemo/wxChoice.rbw
wxruby-2.0.0-x86-mswin32-60 samples/bigdemo/wxChoice.rbw