tklistbox selection

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

tklistbox selection

Sundar Dorai-Raj
Hi,

I'm posting yet another question about tcltk since I'm still struggling
with the package. I'm trying to create a tklistbox and a ttkcombobox on
the same parent and am having a problem. Here's an example:

library(tcltk)
tt <- tktoplevel()
tcl1 <- tclVar()
tcl2 <- tclVar()
tclObj(tcl1) <- letters[1:5]
tclObj(tcl2) <- LETTERS[1]
tb1 <- tklistbox(tt, listvariable = tcl1,
                  selectmode = "multiple")
tb2 <- ttkcombobox(tt, values = LETTERS[1:2],
                    textvariable = tcl2)
tkpack(tb1, tb2)

First, I select some values in the list box. But when I select a value
from the combo box, the selection from the list box is no longer
highlighted. Is this a bug or am I missing something in the
documentation? My goal is to allow highlighted text simultaneously in
both widgets.

Thanks,

--sundar

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: tklistbox selection

Sundar Dorai-Raj
I solved this problem by adding "exportselection = 0" to the call to
tklistbox. I.e.

tb1 <- tklistbox(tt, listvariable = tcl1,
                  exportselection = 0,
                  selectmode = "multiple")

Thanks,

--sundar

Sundar Dorai-Raj said the following on 10/29/2008 5:56 PM:

> Hi,
>
> I'm posting yet another question about tcltk since I'm still struggling
> with the package. I'm trying to create a tklistbox and a ttkcombobox on
> the same parent and am having a problem. Here's an example:
>
> library(tcltk)
> tt <- tktoplevel()
> tcl1 <- tclVar()
> tcl2 <- tclVar()
> tclObj(tcl1) <- letters[1:5]
> tclObj(tcl2) <- LETTERS[1]
> tb1 <- tklistbox(tt, listvariable = tcl1,
>                  selectmode = "multiple")
> tb2 <- ttkcombobox(tt, values = LETTERS[1:2],
>                    textvariable = tcl2)
> tkpack(tb1, tb2)
>
> First, I select some values in the list box. But when I select a value
> from the combo box, the selection from the list box is no longer
> highlighted. Is this a bug or am I missing something in the
> documentation? My goal is to allow highlighted text simultaneously in
> both widgets.
>
> Thanks,
>
> --sundar
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.