Sha256: 8a2a142f7c9a6fbb5376e694dac0fdd3fe19c226244f0e8657b7a6df0b206363

Contents?: true

Size: 423 Bytes

Versions: 2

Compression:

Stored size: 423 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems'
require "newt"

begin

  Newt::Screen.new

  l1 = Newt::Listbox.new(1, 1, 10, Newt::FLAG_SCROLL)
  1.upto(10) do |i|
	l1.append("item #{i}", i)
  end
  l1.append("ITEM", 11)
  1.upto(10) do |i|
	l1.append("item #{i+11}", i+11)
  end
  l1.setCurrentByKey("ITEM")

  b = Newt::Button.new(1, 12, "Exit")

  f = Newt::Form.new
  f.add(l1, b)

  f.run()

ensure
  Newt::Screen.finish
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
newt-0.9.7 examples/test_method/Listbox_current_bykey.rb
newt-0.9.2 examples/test_method/Listbox_current_bykey.rb