Home > Archive > Tcl > October 2006 > More than one (tcl tk) listbox
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
More than one (tcl tk) listbox
|
|
| rossalexander@hotmail.co.uk 2006-10-30, 7:32 pm |
| Hi,
I'm trying to write a tcl application where the user can select a
number of options from different tk listboxes.
The problem that I have is with two lists, A and B, if I select
something from list A, and then select something from list B, the
original list A selection goes away. Is there any way of stopping this?
I'm hoping to add list C and D and then generate results based on the
selections.
Cheers,
Ross.
| |
| Gerald W. Lester 2006-10-30, 7:32 pm |
| rossalexander@hotmail.co.uk wrote:
> Hi,
>
> I'm trying to write a tcl application where the user can select a
> number of options from different tk listboxes.
>
> The problem that I have is with two lists, A and B, if I select
> something from list A, and then select something from list B, the
> original list A selection goes away. Is there any way of stopping this?
>
> I'm hoping to add list C and D and then generate results based on the
> selections.
>
> Cheers,
> Ross.
>
See the -exportselection option
--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
| |
|
|
rossalexander@hotmail.co.uk wrote:
> Hi,
>
> I'm trying to write a tcl application where the user can select a
> number of options from different tk listboxes.
>
> The problem that I have is with two lists, A and B, if I select
> something from list A, and then select something from list B, the
> original list A selection goes away. Is there any way of stopping this?
>
> I'm hoping to add list C and D and then generate results based on the
> selections.
>
> Cheers,
> Ross.
Hi,
I ran into a similar situation with a text widget, where the selection
didn't go away, but it wasn't visible unless the widget had the focus.
I ended up creating my own tags and highlighting them, to keep (visual)
track of the selection. You can't do that in a listbox, AFAIK, but you
could adapt a textbox as your own custom listbox.
Alternatively, a more elaborate listbox like tablelist
(http://wiki.tcl.tk/5527) might do what you want, or you could use
TkTable.
Eric
| |
| billposer@alum.mit.edu 2006-10-30, 7:32 pm |
| > The problem that I have is with two lists, A and B, if I select
> something from list A, and then select something from list B, the
> original list A selection goes away. Is there any way of stopping this?
You can do this easily enough with a listbox. When the user selects an
item in a listbox, record which item it is for your own purposes and
preserve the graphical marking by using itemconfigure to set the colors
for that item. You'll also need to reset the colors for the previously
selected item to normal.
| |
| Bryan Oakley 2006-10-30, 7:32 pm |
| billposer@alum.mit.edu wrote:
>
> You can do this easily enough with a listbox. When the user selects an
> item in a listbox, record which item it is for your own purposes and
> preserve the graphical marking by using itemconfigure to set the colors
> for that item. You'll also need to reset the colors for the previously
> selected item to normal.
>
Setting "-exportselection" to false in all listboxes is a much simpler
solution.
| |
|
|
Bryan Oakley wrote:
> billposer@alum.mit.edu wrote:
>
> Setting "-exportselection" to false in all listboxes is a much simpler
> solution.
Well, I learn something every day. Slightly OT, but would that have
helped with my text widget problem? (Basically the same problem, but
with text widgets.)
Thanks,
Eric
| |
| Bryan Oakley 2006-10-30, 7:32 pm |
| EKB wrote:
> Bryan Oakley wrote:
>
> Well, I learn something every day. Slightly OT, but would that have
> helped with my text widget problem? (Basically the same problem, but
> with text widgets.)
Yes.
| |
| rossalexander@hotmail.co.uk 2006-10-30, 7:32 pm |
|
Bryan Oakley wrote:
>
> Setting "-exportselection" to false in all listboxes is a much simpler
> solution.
Thank Bryan.
Perfect solution,
Ross.
|
|
|
|
|