[R] tcltk: multiple listboxes, selection

From: JeeBee <jeebee_at_troefpunt.nl>
Date: Sat 21 Oct 2006 - 20:52:39 GMT

Dear list,

I have multiple (BWidget) listboxes in the same toplevel window. The problem is, if I select (by left clicking) on one of those listbox elements, the current selection in the *other* listboxes is cleared!
Anybody knows how I can prevent this?

Here's my code (sorry not complete):
(E.g. If I select an X value, I'd lose the Y value I selected before)

gui.create.tab.general <- function(tt) {
# Network topology

  frame.1 <- tkframe(tt)
  combo_topology <- tkwidget(frame.1, "ComboBox", values = infras,     editable = FALSE)
  tcl(combo_topology, "setvalue", "first")   tkgrid(tklabel(frame.1, text="Network topology"), combo_topology)   tkgrid(frame.1, sticky = "w")
# X values

  frame.x <- tkwidget(tt, "labelframe", text = "X value")   tl.x <- tklistbox(frame.x, height = length(xvals) / 2,

                width = 50, selectmode = "browse", background = "white")
  for(i in seq(from=1, to=length(xvals), by=2)) {     tkinsert(tl.x, "end", xvals[[i]])
  tkselection.set(tl.x, 0)
  tkgrid(tl.x, sticky="news")
# Y values

  frame.y <- tkwidget(tt, "labelframe", text = "Y value(s)")   tl.y <- tklistbox(frame.y, height = 20, #length(yvals) / yvals.field.count,
                yscrollcommand=function(...) tkset(scr.y,...),
                width = 50, selectmode = "extended", background = "white")
  scr.y <- tkscrollbar(frame.y, repeatinterval = 5,     command = function(...) tkyview(tl.y, ...))   for(i in seq(from=1, to=length(yvals), by=yvals.field.count)) {     tkinsert(tl.y, "end", yvals[[i]])
  tkselection.set(tl.y, 0)
  tkgrid(tl.y, scr.y, sticky="news")
# Packing

  tkgrid(frame.x, frame.y, sticky="news")

         #side = "left", fill = "both", expand = TRUE) }

R-help@stat.math.ethz.ch 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. Received on Sun Oct 22 07:05:23 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 21 Oct 2006 - 22:30:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.