| |||||||||||
listbox question Posted by toffe (toffe), 10 May 2005 I'm a tcl/tk newbie with a listbox problem.I have a listbox with a number of entries. I also have an entry widget which is supposed to assign a position in a list depending on what is selected in the listbox. I do curselection on ButtonPress and ButtonRealease in the listbox to find out which index was selected and which is now selected. This in order to save away the entry to the approriate position in my list and then update the entry with the value from the new selection. Problem is that when I use tab to go to the entry or when I select the text in the entry the highlight in the listbox disappears and curselection return an empty string. If I just click the entry and enter a value it all works fine. How can I gets this working the way I want? Regards, Kristoffer Posted by admin (Graham Ellis), 10 May 2005 Can you supply some sample code? I tried to work out the sequences that you've described and came up with:Code:
I think the bind commands at the very end might be your solution - the first notices when you tab off the listbox and telly you which item was selected at the time ... the second resets that on the listbox when you enter text in the entry box. The report button and label don't relate directly to the question - they just help you see the state of the variables and how the test code works if you try it out. Posted by toffe (toffe), 12 May 2005 Thanks for your detailed answer!That would certainly solve the tabbing issue. If you select an item in your listbox and then select the text in the entry you have my other problem though. I.e you select the text in the entry so that it is highlighted as you would if you wanted to replace it. Is the solution to bind the Leave event so that whenever the mouse leaves the listbox i save what the selection was? I'm going to try this out a bit. Wish there was some practical way to always leave the selected item in the listbox highlighted and selected. Thanks again! This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |