An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-gui/attachments/20090515/ae159a0d/attachment.pl>
[R-gui] tktable topleft
2 messages · David Katz, j verzani
1 day later
David Katz <david <at> davidkatzconsulting.com> writes:
How can I access the row and column of the tktable that is visible in the top left corner of the display? The docs mention an index called topleft but I don't know how to access it from the tcltk package.
The topleft index refers to the top left editable cell. Try the 0,0 index, as in
the code below:
library(tcltk)
tclRequire("Tktable")
a <- tclArray()
m <- rbind(c("","h1","h2"),
c("r1", "1", "2"),
c("r2", "3", "4"))
## col. headings
sapply(2:ncol(m), function(j)
a[[0,j-1]] <- as.tclObj(m[1,j]))
## fill in row by row
sapply(2:nrow(m), function(i)
sapply(1:ncol(m), function(j)
a[[i-1, j-1]] <- as.tclObj(m[i,j])))
w <- tktoplevel()
tbl <- tkwidget(w, "table", variable=a,
rows = nrow(m),
cols = ncol(m),
titlerows=1, titlecols=1)
tkpack(tbl)
## adjust upper cell
tkset(tbl,"0,0","text")
--John