Re: [Rd] using yscrollcommand in tkcanvas crashes R (PR#13231)
On Thu, 30 Oct 2008 [EMAIL PROTECTED] wrote: > Full_Name: Sundar Dorai-Raj > Version: 2.8.0 > OS: Windows > Submission from: (NULL) (76.220.41.126) > > > The following code crashes R: > > library(tcltk) > tt <- tktoplevel() > tc <- tkcanvas(tt, yscrollcommand = function(...) tkset(ts, ...)) > > > sessionInfo() > R version 2.8.0 (2008-10-20) > i386-pc-mingw32 > > locale: > LC_COLLATE=English_United States.1252;LC_CTYPE=English_United > States.1252;LC_MONETARY=English_United > States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 > > attached base packages: > [1] tcltk stats graphics grDevices utils datasets methods > [8] base > Here's a portion of the code I wrote for a package that contains a scrollable canvas, if it helps you any. .RDEnv <- new.env(hash=TRUE) # Private environment rdenv <- function() { return(.RDEnv) } scrollframe_create <- function(parent) { stopifnot(is.tkwin(parent)) frame <- tkframe(parent, class="ScrollFrame") xscroll <- tkscrollbar(frame, orient="horizontal", command=function(...) tkxview(vport, ...)) yscroll <- tkscrollbar(frame, orient="vertical", command=function(...) tkyview(vport, ...)) vport <- tkcanvas(frame, xscrollcommand=function(...) tkset(xscroll, ...), yscrollcommand=function(...) tkset(yscroll, ...)) pady <- paste("0", tclvalue(tkwinfo.reqheight(xscroll))) tkpack(yscroll, side="right", fill="y", pady=pady) tkpack(xscroll, side="bottom", fill="x") tkpack(vport, side="left", fill="both", expand=TRUE) int.frame <- tkframe(vport, borderwidth=4, relief="groove") tkcreate(vport, "window", "0 0", anchor="nw", window=int.frame$ID) tkbind(int.frame, "", function() scrollframe_resize(int.frame)) ## Save this so items can be put in it assign("interior.frame", int.frame, envir=rdenv()) return(frame) } scrollframe_resize <- function(iframe) { stopifnot(tclvalue(tkwinfo.class(iframe)) == "Frame") w <- tkwinfo.width(iframe) h <- tkwinfo.height(iframe) vport <- tkwinfo.parent(iframe) stopifnot(tclvalue(tkwinfo.class(vport)) == "Canvas") bbox <- tkbbox(vport, "all") tkconfigure(vport, width=w, height=h, scrollregion=bbox, xscrollincrement="0.1i", yscrollincrement="0.1i") } scrollframe_interior <- function() { return(get("interior.frame", envir=rdenv())) } -- SIGSIG -- signature too long (core dumped) __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] using yscrollcommand in tkcanvas crashes R (PR#13231)
Hi, Greg, Thanks again for your comments. I got it to work with your suggestion: library(tcltk) tt <- tktoplevel() ts <- ttkscrollbar(tt) tc <- tkcanvas(tt) tkconfigure(ts, command = function(...) tkyview(tc, ...)) tkconfigure(tc, yscrollcommand = function(...) tkset(ts, ...)) tkpack(tc, side = "left") tkpack(ts, side = "right", fill = "y") I think the bug should remain open though, because crashing R is never a good thing. But for now, it's not on my critical path. Thanks, --sundar [EMAIL PROTECTED] said the following on 10/30/2008 8:40 AM: I don't know if this is the case here or not, but putting in scrollbars and= scrolling can be a bit tricky. It usually works best to create the canvas= without a scroll command, then create the scrollbar(s), then use tkconfig = to go back and add the scroll command to the canvas after the scrollbar has= been created and placed. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] project.org] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, October 29, 2008 11:10 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [Rd] using yscrollcommand in tkcanvas crashes R (PR#13231) Full_Name: Sundar Dorai-Raj Version: 2.8.0 OS: Windows Submission from: (NULL) (76.220.41.126) The following code crashes R: library(tcltk) tt <- tktoplevel() tc <- tkcanvas(tt, yscrollcommand =3D function(...) tkset(ts, ...)) sessionInfo() R version 2.8.0 (2008-10-20) i386-pc-mingw32 locale: LC_COLLATE=3DEnglish_United States.1252;LC_CTYPE=3DEnglish_United States.1252;LC_MONETARY=3DEnglish_United States.1252;LC_NUMERIC=3DC;LC_TIME=3DEnglish_United States.1252 attached base packages: [1] tcltk stats graphics grDevices utils datasets methods [8] base __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] using yscrollcommand in tkcanvas crashes R (PR#13231)
I don't know if this is the case here or not, but putting in scrollbars and= scrolling can be a bit tricky. It usually works best to create the canvas= without a scroll command, then create the scrollbar(s), then use tkconfig = to go back and add the scroll command to the canvas after the scrollbar has= been created and placed. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > project.org] On Behalf Of [EMAIL PROTECTED] > Sent: Wednesday, October 29, 2008 11:10 PM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: [Rd] using yscrollcommand in tkcanvas crashes R (PR#13231) > > Full_Name: Sundar Dorai-Raj > Version: 2.8.0 > OS: Windows > Submission from: (NULL) (76.220.41.126) > > > The following code crashes R: > > library(tcltk) > tt <- tktoplevel() > tc <- tkcanvas(tt, yscrollcommand =3D function(...) tkset(ts, ...)) > > > sessionInfo() > R version 2.8.0 (2008-10-20) > i386-pc-mingw32 > > locale: > LC_COLLATE=3DEnglish_United States.1252;LC_CTYPE=3DEnglish_United > States.1252;LC_MONETARY=3DEnglish_United > States.1252;LC_NUMERIC=3DC;LC_TIME=3DEnglish_United States.1252 > > attached base packages: > [1] tcltk stats graphics grDevices utils datasets methods > [8] base > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] using yscrollcommand in tkcanvas crashes R (PR#13231)
I don't know if this is the case here or not, but putting in scrollbars and scrolling can be a bit tricky. It usually works best to create the canvas without a scroll command, then create the scrollbar(s), then use tkconfig to go back and add the scroll command to the canvas after the scrollbar has been created and placed. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > project.org] On Behalf Of [EMAIL PROTECTED] > Sent: Wednesday, October 29, 2008 11:10 PM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: [Rd] using yscrollcommand in tkcanvas crashes R (PR#13231) > > Full_Name: Sundar Dorai-Raj > Version: 2.8.0 > OS: Windows > Submission from: (NULL) (76.220.41.126) > > > The following code crashes R: > > library(tcltk) > tt <- tktoplevel() > tc <- tkcanvas(tt, yscrollcommand = function(...) tkset(ts, ...)) > > > sessionInfo() > R version 2.8.0 (2008-10-20) > i386-pc-mingw32 > > locale: > LC_COLLATE=English_United States.1252;LC_CTYPE=English_United > States.1252;LC_MONETARY=English_United > States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 > > attached base packages: > [1] tcltk stats graphics grDevices utils datasets methods > [8] base > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] using yscrollcommand in tkcanvas crashes R (PR#13231)
Full_Name: Sundar Dorai-Raj Version: 2.8.0 OS: Windows Submission from: (NULL) (76.220.41.126) The following code crashes R: library(tcltk) tt <- tktoplevel() tc <- tkcanvas(tt, yscrollcommand = function(...) tkset(ts, ...)) > sessionInfo() R version 2.8.0 (2008-10-20) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] tcltk stats graphics grDevices utils datasets methods [8] base __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel