Hi,
ยทยทยท
From: mhm26@drexel.edu (matt)
Subject: Ruby/Tk: Listbox loses selection
Date: Thu, 10 Jun 2004 00:08:41 +0900
Message-ID: <13383d7a.0406090707.27c393e7@posting.google.com>
I'm having trouble with a listbox object. When I have a listbox and
it has some items selected, and I focus on another widget (say a
TkEntry...), it will sometimes lose the selection(s). Sometimes this
doesn't happen until the widget the second widget I focus on
afterwards, and sometimes the third, etc.
Probably, you drags the mouse when click the entry widget or
other widgets.
On the following Ex.1, the listbox loses the selection when
you drag the mouse on the entry widget, because the entry widget
makes new selection.
----- Ex.1 -------------------------------------------
TkEntry.new.pack
TkListbox.new.pack.insert(0, *%w(aaa bbb ccc ddd eee fff))
Tk.mainloop
------------------------------------------------------
If you want to keep the selection on the listbox widget,
you should not allow other widgets to treat selection.
On the following Ex.2, the listbox keeps the selection
as if you drags the mouse on the entry widget.
----- Ex.2 -------------------------------------------
TkEntry.new(:exportselection=>false).pack
TkListbox.new.pack.insert(0, *%w(aaa bbb ccc ddd eee fff))
Tk.mainloop
------------------------------------------------------
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)