Sha256: 3b383172f6adca0428b6f47eeef1e14c4dbf30784498df0785131ffc49321dad

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 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

4 entries across 4 versions & 1 rubygems

Version Path
wxruby-1.9.5-i386-mswin32 samples/bigdemo/wxChoice.rbw
wxruby-1.9.4-i386-mswin32 samples/bigdemo/wxChoice.rbw
wxruby-1.9.2-i386-mswin32 samples/bigdemo/wxChoice.rbw
wxruby-1.9.1-i386-mswin32 samples/bigdemo/wxChoice.rbw