From: Mark Volkmann Date: 2004-11-15T12:49:41+09:00 Subject: Re: update delay related to TkOptionMenu ----- Original Message ----- From: "Hidetoshi NAGAI" To: "ruby-talk ML" Sent: Sunday, November 14, 2004 9:04 PM Subject: Re: update delay related to TkOptionMenu > Hi, > > From: "Mark Volkmann" > Subject: Re: update delay related to TkOptionMenu > Date: Mon, 15 Nov 2004 11:39:00 +0900 > Message-ID: <042701c4cabc$43bc8ff0$0200a8c0@MarkDesktop> >> Thanks for the suggestion. Unfortunately, that didn't change anything. I >> still don't see the update to the TkEntry until I click the >> TkOptionButtonmenu a second time. > > Could you tell me your environment? Windows XP SP 2 >> Is there a different event I could bind to instead? > > You can use TkVariable.trace. > For example, > ----------------------------------------------------------------- > require 'tk' > > root = TkRoot.new > > value_tbl = { > 'Marathon' => 26.2, > '10K' => 6.2, > 'other' => 0, > } > value_tbl.default = 0 > > init_val = 'other' > option_var = TkVariable.new(init_val) > entry_var = TkVariable.new(value_tbl[init_val]) > > w = TkOptionMenubutton.new(root, option_var) > w.insert(init_val, 'Marathon') > w.insert(init_val, '10K') > w.pack > > TkEntry.new(root, :textvariable=>entry_var).pack > > option_var.trace('w'){ > entry_var.value = value_tbl[option_var.value] > } > > Tk.mainloop > ----------------------------------------------------------------- > -- > Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) > >