[R-gui] Tk/Windows focus problems

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Apr 8 20:59:26 CEST 2004


wettenhall at wehi.edu.au writes:

> Hi,
> 
> I'm posting ONLY TO THE R-SIG-GUI LIST in case I was boring anyone.

Not at all. WhatYouDo != WhatIThoughtYou'dDo, so if we combine the
two, maybe we can finally get somewhere with this.
 
> To clarify how I am getting window IDs, I have installed (in Windows XP),
> R 1.8.1, ActivePerl-5.6.1, the Win32:GuiTest perl module (on CPAN),
> and the spy.pl script from
> http://triumvir.org/prog/perl/guitest/guitest-spy.html

OK for now, in the longer perspective, I think we can just extract
that info from the GraphApp structures.

> library(tcltk)
> tt1 <- tktoplevel(use="0x00050112")  # The RGui Workspace Window ID
> 
> Result: If RGui is maximized, it goes back to "normal/unmaximized" size. 
> No "Tk" window appears, i.e. tt1 now points to the main RGui window.
> 
> To confirm this:
> tkwm.title(tt1,"Hello")
> "Hello" now appears in the title bar of the main RGui window.

Fine, shows that basic procedure work, but I think you're on the wrong
track by tacking onto the root MDI window.
 
> tt1a <- tktoplevel(tt1)

Now this I suspect is the wrong idea. This just creates a new window
which Tk thinks is a child of tt1, but I don't think that implies that
it becomes part of the MDI group, so you get the same behaviour as
without the use=... stuff. 

[SDI stuff omitted]

> OK, now back to MDI mode...

> Now I use the R Console ID in tktoplevel(use=...) instead of
> the RGui ID :
> 
> library(tcltk)
> tt2 <- tktoplevel(use="0x000900F4")
> The first time I did this (above), it took quite a while
> (a couple of seconds), but didn't give an error or warning.
> 
> tt2a <- tktoplevel(tt2)

I still don't think that's what you want to do...

I'd be much more interested in what happens if you do something like
tkbutton(tt2). Or maybe you don't want to try that with the console
window, so how about hijacking a graphics window instead? The
perspective could be to modify toplevel so that it generates blank
(MDI-controlled) windows from GraphApp, which we just keep using from
then on.


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907



More information about the R-SIG-GUI mailing list