From keith at wehi.EDU.AU  Mon Nov 19 06:05:43 2012
From: keith at wehi.EDU.AU (Keith)
Date: Mon, 19 Nov 2012 16:05:43 +1100
Subject: [Rd] tcltk freezing using MS Windows for R-2.14+
Message-ID: <50A9BE27.7090404@wehi.edu.au>

I am the maintainer of a Bioconductor package (affylmGUI) which uses 
tcltk. It freezes inconsistently on MS Windows, but not Mac or Unix. see 
details below.

After considerable testing I have reduced the problem from a few 
thousand lines of code to 30 lines!

If you paste the following lines of code into an R window:


testGUI <- function(){
     require(tcltk)
     MainWindow <- tktoplevel()
     topMenu <- tkmenu(MainWindow)
     tkconfigure(MainWindow,menu=topMenu)
     normalizeMenu <- tkmenu(topMenu, tearoff=FALSE)
     tkadd(normalizeMenu,"command",label="Normalize",command = 
function() NormalizeNow(MainWindow))
     tkadd(topMenu, "cascade", label="MainWindow", menu = normalizeMenu)
     tkfocus(MainWindow)
     #
}#end of testGUI <- function()
#
NormalizeNow <- function(MainWindow){
     NMethod <- GetNMethod(MainWindow)
     if (NMethod=="") return()
     tkconfigure(MainWindow,cursor="watch")
     tkfocus(MainWindow)
}#end of NormalizeNow <- function(){
#
GetNMethod <- function(MainWindow){
     ReturnVal <- "RMA"
     GNMethod <- tktoplevel(MainWindow)
     tkwm.deiconify(GNMethod)
     tkgrab.set(GNMethod)
     tkfocus(GNMethod)
     tkwm.title(GNMethod,"Get Method")
     tkbind(GNMethod,"<Destroy>",function() {ReturnVal <- 
"";tkgrab.release(GNMethod);tkfocus(MainWindow);})
     tkwait.window(GNMethod)
     return (ReturnVal)
}#end of GetNMethod <- function()


and then run the function testGUI()

A Main Window pops up with "Main Window" in the Menu bar. Click on "Main 
Window" and the first (and only) item on the menu drops down and it is 
called "Normalize". Clicking this opens another windows entitled "Get 
Method". If there is a problem (it is intermittent), it is evidenced by 
the fact that the "Get Method" window will not close.

It cannot be closed by clicking. The window is frozen open. It can be 
moved but not closed. On MS Windows, the "Get Method" window can be 
closed using the right button close window option on the task bar icon  
Typically the problem occurs infrequently in the first 10 presses on the 
"Normalize" item, but more frequently there after.

I have NOT had the problem on Mac OSX or Linux.

On MS Windows (I have tested on Win XP-32bit and Win7-64bit) the problem 
occurs in R-2.16.0, R-2.15.2, R-2.15.1,R-2.14.0.

THERE IS NO PROBLEM WITH R-2.13.1 and R-2.13.0

I have run it using debug("GetNMethod"). Stepping through the GetNMethod 
function results in freezing when asked to do the "tkgrab.set(GNMethod)" 
instruction.

I would appreciate if others can confirm similar behaviour.

Can anyone suggest why it worked under R-2.13.x but not in later 
versions of R.

Was there a change in R that impacts with this aspect of tcltk?

Is there a work around for this problem?

Any suggestions appreciated,

thanks

Keith Satterley
affylmGUI, limmaGUI maintainer.
Bioinformatics Division
The Walter and Eliza Hall Institute
Melbourne, Australia.

Some sessionInfo() outputs:



Win7-64bit-R-2.15.2  testGUI() fails intermittently.
 > sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=C
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252

attached base packages:
[1] tcltk     stats     graphics  grDevices utils     datasets methods   
base



Linux x64-R-2.15.2. testGUI() works always
R version 2.15.2 (2012-10-26)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=C                 LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] tcltk     stats     graphics  grDevices utils     datasets methods
[8] base



Mac OS X R-2.15.2.  testGUI() works always
 > sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] tcltk     stats     graphics  grDevices utils     datasets methods   
base



WinXP-32bit--R-2.15.2.  testGUI() fails intermittently
  > sessionInfo()
  R version 2.15.2 (2012-10-26)
  Platform: i386-w64-mingw32/i386 (32-bit)

  locale:
  [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 
LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
  [5] LC_TIME=English_Australia.1252

  attached base packages:
  [1] tcltk     stats     graphics  grDevices utils     datasets 
methods   base



Win7-R-2.13.1.  testGUI() works always
 > sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=C
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252

attached base packages:
[1] tcltk     stats     graphics  grDevices utils     datasets methods   
base




______________________________________________________________________
The information in this email is confidential and intend...{{dropped:4}}



[Rd] tcltk freezing using MS Windows for R-2.14+
Keith