[R-gui] Tk/Windows focus problems

James Wettenhall wettenhall at wehi.edu.au
Thu Apr 8 11:28:33 CEST 2004


Hi,

I had a look at the R-Devel thread when John Fox introduced 
RCmdr and Peter Dalgaard suggested searching Google Groups for 
tk Windows "always on top"

So I found at least one way to keep Tk windows on top.  But it 
keeps them on top of everything (except for other always_on_top 
windows), not just RGui.

Download 
http://www.jessikat.fsnet.co.uk/dll.zip
from 
http://www.jessikat.fsnet.co.uk/docdll.html

Extract it somewhere, (let's say C:\dllTcl)

Now in R,

library(tcltk)
setwd("c:/dllTcl")
dir()
.Tcl("load dll10.dll")
tt <- tktoplevel()

hWnd  <- tkwm.frame(tt)
success <- tkcmd("::dll::call","user32.dll","SetWindowPos","i",
  tclvalue(tkcmd("list","i",tclvalue(hWnd))),
  tclvalue(tkcmd("list","i","-1")),
  c("i","0"),c("i","0"),c("i","0"),c("i","0"),c("i","0x13"))

# Now window tt should stay on top of RGui!

I also tried tktoplevel(use=RGuiWindowID), but that didn't work.  
The Tk windows still insisted on hiding behind RGui.

I got the RGui window ID using the perl module Win32::GuiTest 
from:
http://triumvir.org/prog/perl/guitest/

The webpage provides a script (Spy--) which gives you window 
IDs.

Regards
James

--------------------------------------------------------------------------
James Wettenhall                                  Tel: (+61 3) 9345 2629
Division of Genetics and Bioinformatics           Fax: (+61 3) 9347 0852
The Walter & Eliza Hall Institute         E-mail: wettenhall at wehi.edu.au
 of Medical Research,                     Mobile: (+61 / 0 ) 438 527 921    
1G Royal Parade,
Parkville, Vic 3050, Australia
http://www.wehi.edu.au



More information about the R-SIG-GUI mailing list