Does anyone know of an example that shows the correct use of
tk_optionMenu in Ruby/Tk? All references I can find deal with popping
up a “normal” menu.
Thanks,
Ken
Does anyone know of an example that shows the correct use of
tk_optionMenu in Ruby/Tk? All references I can find deal with popping
up a “normal” menu.
Thanks,
Ken
From: Kenneth McDonald [email protected]
Subject: tk_optionMenu in Ruby/Tk
Date: Thu, 4 Dec 2008 01:05:36 +0900
Message-ID: [email protected]
Does anyone know of an example that shows the correct use of
tk_optionMenu in Ruby/Tk? All references I can find deal with popping
up a “normal” menu.
require ‘tk’
parent = Tk.root
v = TkVariable.new
TkLabel.new(parent, :textvariable=>v).pack
TkOptionMenubutton.new(parent, v, *%w(foo bar baz hoge fuga)).pack
However, 2nd style doesn’t work because of a bug of tk/menu.rb.
Please use the following patch. I’ll commit it to ruby-svn.
— menu.rb (revision 20349)
+++ menu.rb (working copy)
@@ -569,7 +569,7 @@
keys = _symbolkey2str(keys)
parent = nil
if !args.empty? && (args[0].kind_of?(TkWindow) || args[0] == nil)
keys.delete(‘parent’) # ignore
parent = args.shift
else
@@ -577,7 +577,7 @@
end
@variable = nil
Thanks Hidetoshi!
Ken
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs