Dear R-devel list members,

I've encountered a problem with my Rcmdr package under Windows XP and could use some advice:

The Rcmdr package uses the tcltk package to create menus and dialog boxes. My standard procedure when a dialog is created is to grab the focus -- e.g., by

    tkfocus(top)
    tkgrab(top)

(Here, top is a top-level window -- say, containing one or more scrollbars.) When the window is closed, I release the focus, destroy the window, and return the focus to another window -- e.g.,

    tkgrab.release(top)
    tkdestroy(top)
    . . .
    tkfocus(.commander)

(Here .commander is a top-level window residing in the global environment.)

This procedure works fine under Windows 2000 -- where I've done most of the testing of the Rcmdr package under Windows -- but I received a report of a problem from a Windows XP user, who noted that scrollbars tend to get stuck. I was able to reproduce the problem intermittently on an XP system, and found that the problem appears to go away when I remove the calls to tkgrab() and tkgrab.release().

You can test for the problem with the following code:

window1 <- tktoplevel()
window2 <- tktoplevel()
xFrame <- tkframe(window2)
xScroll <- tkscrollbar(xFrame, repeatinterval=5, command=function(...) tkyview(xBox, ...))
xBox <- tklistbox(xFrame, height=4,
selectmode="single", background="white", exportselection="FALSE",
yscrollcommand=function(...) tkset(xScroll, ...))
for (x in letters) tkinsert(xBox, "end", x)
onOK <- function() {
tkgrab.release(window2)
tkfocus(window1)
tkdestroy(window2)
}
OKbutton <- tkbutton(window2, text="OK", width="12", command=onOK, default="active")
tkgrid(xBox, xScroll, sticky="nw")
tkgrid.configure(xScroll, sticky="ns")
tkgrid(xFrame, sticky="w")
tkgrid(OKbutton, sticky="w")
tkselection.set(xBox, 0)
tkbind(window2, "<Return>", onOK)
tkfocus(window2)
tkgrab(window2)


I find that I can make the scrollbar stick under Windows XP by repeatedly and rapidly pressing the scroll-down button. As mentioned, removing the calls to tkgrab() and tkgrab.release() seems to eliminate the problem.

I wonder whether anyone else has encountered this problem or has any insight into its source. Am I doing something wrong here? I could simply remove the calls to tkgrab() and tkgrab.release() throughout the package, or make them optional, perhaps checking for Windows XP via shell("ver", intern=TRUE)[2], but I'd rather solve the problem.

I've also had a report of tk windows failing to stay on top of the R-GUI SDI Console in Windows XP, but I haven't been able to duplicate this problem, and it has never occurred in my testing under Windows 2000 and Linux. Has anyone else experienced this behaviour?


Thanks, John ----------------------------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: [EMAIL PROTECTED] phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel

Reply via email to