Sha256: 52dd27981f5b646e8216700800992862c793b76309d39320dfabfe7c341af71b

Contents?: true

Size: 1.28 KB

Versions: 20

Compression:

Stored size: 1.28 KB

Contents

#!/usr/bin/env ruby

begin
  require 'wx'
rescue LoadError => no_wx_err
  begin
    require 'rubygems'
    require 'wx'
  rescue LoadError
    raise no_wx_err
  end
end

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

20 entries across 20 versions & 1 rubygems

Version Path
wxruby-1.9.3-i386-mswin32 samples/bigdemo/wxChoice.rbw
wxruby-1.9.2-powerpc-darwin8.10.0 samples/bigdemo/wxChoice.rbw
wxruby-1.9.2-i686-linux samples/bigdemo/wxChoice.rbw
wxruby-1.9.2-i686-darwin8.8.2 samples/bigdemo/wxChoice.rbw
wxruby-1.9.1-powerpc-darwin8.3.0 samples/bigdemo/wxChoice.rbw
wxruby-1.9.1-i686-linux samples/bigdemo/wxChoice.rbw
wxruby-1.9.1-i686-darwin8.4.1 samples/bigdemo/wxChoice.rbw
wxruby-1.9.0-powerpc-darwin8.10.0 samples/bigdemo/wxChoice.rbw
wxruby-1.9.0-i686-linux samples/bigdemo/wxChoice.rbw
wxruby-1.9.0-i686-darwin8.4.1 samples/bigdemo/wxChoice.rbw
wxruby-1.9.0-i386-mswin32 samples/bigdemo/wxChoice.rbw
wxruby-1.9.1-x86_64-linux samples/bigdemo/wxChoice.rbw
wxruby-1.9.3-universal-darwin samples/bigdemo/wxChoice.rbw
wxruby-1.9.2-x86_64-linux samples/bigdemo/wxChoice.rbw
wxruby-1.9.3-x86-linux samples/bigdemo/wxChoice.rbw
wxruby-1.9.4-x86-linux samples/bigdemo/wxChoice.rbw
wxruby-1.9.4-x86_64-linux samples/bigdemo/wxChoice.rbw
wxruby-1.9.5-universal-darwin-9 samples/bigdemo/wxChoice.rbw
wxruby-1.9.5-x86-linux samples/bigdemo/wxChoice.rbw
wxruby-1.9.5-x86_64-linux samples/bigdemo/wxChoice.rbw