Ruby/Tk: Listbox loses selection

M

matt

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.

I found http://groups.google.com/groups?hl=...=CSSCb.545043%24Fm2.516474%40attbi_s04&rnum=1
- but that doesn't really make much sense to me - any help?

Thanks,

Matt
 
H

Hidetoshi NAGAI

Hi,

From: (e-mail address removed) (matt)
Subject: Ruby/Tk: Listbox loses selection
Date: Thu, 10 Jun 2004 00:08:41 +0900
Message-ID: said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top