Hello Eduardo, Regarding the problem with a single column, your request of alternate row background, and other limitations of the tk2mclistbox, I am considering to change for a better implementation of this widget in Tcl/Tk: tablelist, see: http://www.davidmarshall.net/doc/tablelist-4.0/tablelist.html.
Either, you wait for the next tcltk2 release (depending on my free time), or you can anticipate. Just look in the tcltk2 code on how tk2mclistbox is implemented, and you should figure out how to replace it by tablelist, or better, tablelist_tile. Tablelist is written in pure Tcl. So, you don't need to compile it and the code runs on all R supported platforms. Best, Philippe Grosjean ..............................................<°}))><........ ) ) ) ) ) ( ( ( ( ( Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( ( Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons-Hainaut University, Belgium ( ( ( ( ( .............................................................. eduardo san miguel wrote: > Hello, > > I have a tk2mclistbox displaying some data (a matrix). > It works OK while ncol(matrix) > 1; but when matrix is one-columned, only > the first row seems to be displayed. > what am I missing? > > And talking about tk2mclistbox, is there a way to display rows with > different (alternate) background colors? > > Thanks. > Eduardo San Miguel > > > require(tcltk2) > > fillt <- function() { > nCols = as.numeric(tkget(tl.e1)) > nRows = as.numeric(tkget(tl.e2)) > > # remove existing columns > COLUMNS <- tclvalue(.Tcl( paste( tl.t, 'column names'))) > for (i in 1:length(COLUMNS)){ > .Tcl( paste( tl.t, 'column delete', COLUMNS[i])) > } > > # generate matrix > data = matrix(rnorm(nRows*nCols), nc = nCols) > > # tricky way to display one-column data > # auxcol <- matrix(rep(0, dim(data)[1]), ncol = 1) > # tk2column(tl.t, 'add', 'auxcol', label = 'auxcol', > # width = 20) > # tk2column(tl.t,'configure', 'auxcol', visible = 0) > > # insert data > for (i in 1:dim(data)[2]){ > tk2column(tl.t, 'add', paste('col_',i, sep =''), > label = paste('col_',i, sep =''), width = 20) > } > > > # tricky way to display one-column data > # data = cbind(auxcol, data) > tk2insert.multi(tl.t, 'end', data) > > tkconfigure(tl.t, columnborderwidth = 1) > tkconfigure(tl.t, columnbd = 1) > } > > tl <- tktoplevel() > > tl.f1 <- tk2frame(tl) > tl.l1 <- tk2label(tl.f1, text = 'N Cols:') > tl.l2 <- tk2label(tl.f1, text = 'N Rows:') > tl.e1 <- tk2entry(tl.f1 ,'n Cols ', width = 5) > tl.e2 <- tk2entry(tl.f1 ,'n Rows ', width = 5) > tl.f1.b <- tk2button(tl.f1, ' ', text = 'Show Matrix', > command = fillt) > tl.f1.b1 <- tk2button(tl.f1, ' ', text = 'Close', > command = function() tkdestroy(tl)) > > tl.f2 <- tk2frame(tl) > tl.t <- tk2mclistbox(tl.f2, width = 84, resizablecolumns = TRUE) > tl.scr_1 <- tk2scrollbar(tl.f2, orient = 'vertical') > tl.scr_2 <- tk2scrollbar(tl.f2, orient = 'horizontal') > > tkconfigure(tl.t, yscrollcommand = function(...) tkset(tl.scr_1, ...)) > tkconfigure(tl.scr_1, command = function(...) tkyview(tl.t, ...)) > tkconfigure(tl.t, xscrollcommand = function(...) tkset(tl.scr_2, ...)) > tkconfigure(tl.scr_2, command = function(...) tkxview(tl.t, ...)) > > tkpack(tl.scr_2, side = 'bottom', fill = 'x') > tkpack(tl.scr_1, side = 'right', fill = 'y') > tkpack(tl.t, fill = 'both', expand = 1) > > tkgrid(tl.f1) > tkgrid(tl.l1, row = 0, column = 0) > tkgrid(tl.e1, row = 0, column = 1) > tkgrid(tl.l2, row = 0, column = 2) > tkgrid(tl.e2, row = 0, column = 3) > tkgrid(tl.f1.b, row = 0, column = 4) > tkgrid(tl.f1.b1, row = 0, column = 5) > tkgrid(tl.f2) > > tkconfigure(tl.t, relief = 'sunk') > tkbind(tl.t,'<Enter>',function() tkfocus(tl.t)) > > [[alternative HTML version deleted]] > > _______________________________________________ > R-SIG-GUI mailing list > R-SIG-GUI@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/r-sig-gui > _______________________________________________ R-SIG-GUI mailing list R-SIG-GUI@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-gui