[R-gui] Editor in R and Tk/Windows focus problems

John Fox jfox at mcmaster.ca
Wed Apr 7 16:23:16 CEST 2004

Dear James, 

> -----Original Message-----
> From: r-sig-gui-bounces at stat.math.ethz.ch 
> [mailto:r-sig-gui-bounces at stat.math.ethz.ch] On Behalf Of 
> wettenhall at wehi.EDU.AU
> Sent: Wednesday, April 07, 2004 8:36 AM
> To: p.dalgaard at biostat.ku.dk
> Cc: Soren.Hojsgaard at agrsci.dk; r-sig-gui at stat.math.ethz.ch
> Subject: Re: [R-gui] Editor in R and Tk/Windows focus problems
> Apologies if people get multiple copies of recent emails.  We 
> just upgraded to Fedora, and I've been having pine/email problems...
> Søren,
> Great start with the Tcl/Tk editor for R.  A bit more work to 
> do to compete with some of the sophisticated editors at 
> http://www.sciviews.org/_rgui/projects/Editors.html
> but I think it's worth doing!
> You may want to try the command:
> tksearch(txt,"foo","0.0","end")
> to search for "foo" between line 0, column 0 of the text 
> widget and the end.  A result like "4.5" means "foo" was 
> found on line 4, column 5.  This could be useful for 
> parenthesis matching.
> tkindex(txt,"insert") should give you the current cursor position.

The minimal editor in the Rcmdr package script window has standard editing
operations such as Find, Copy, Paste, etc. (along with some other stuff,
such as a submit button), accessible from the window menu and a right-click
context menu, so it wouldn't be hard simply to use this code.

> While I think a Tcl/Tk IDE/script editor for R is a great 
> idea, Windows users may be concerned about the problem of Tk 
> windows repeatedly hiding behind the RGui window (or 
> RGui/GraphApp stealing the focus).  This is particularly a 
> problem if I have my Windows taskbar on autohide.  When I 
> move my mouse from the taskbar to the (maximized) RGui 
> window, the taskbar disappears but so do any Tk windows run from R.

It would be nice to fix this problem, which I believe only occurs with the
multiple-document interface.


> I'm trying to look into the GraphApp code to see if I can 
> find any clues.  Maybe one ugly way would be :
> tktoplevel(use=GraphAppRConsoleWindowID)
> where that window ID would have to be made available from the 
> C code in R-devel/src/gnuwin32/  ???
> >From the Tk toplevel help...
> Command-Line Name: -use
> Database Name: use
> Database Class: Use
> This option is used for embedding. If the value isn't an 
> empty string, it must be the the window identifier of a 
> container window, specified as a hexadecimal string like the 
> ones returned by the winfo id command. The toplevel widget 
> will be created as a child of the given container instead of 
> the root window for the screen. If the container window is in 
> a Tk application, it must be a frame or toplevel widget for 
> which the -container option was specified. This option may 
> not be changed with the configure widget command.
> Regards,
> James
> _______________________________________________
> R-SIG-GUI mailing list
> R-SIG-GUI at stat.math.ethz.ch
> https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-gui

More information about the R-SIG-GUI mailing list