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

wettenhall at wehi.EDU.AU wettenhall at wehi.EDU.AU
Wed Apr 7 15:35:54 CEST 2004

Apologies if people get multiple copies of recent emails.  We just
upgraded to Fedora, and I've been having pine/email problems...


Great start with the Tcl/Tk editor for R.  A bit more
work to do to compete with some of the sophisticated editors at

but I think it's worth doing!

You may want to try the command:
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


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.

I'm trying to look into the GraphApp code to see if I can find
any clues.  Maybe one ugly way would be :


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.


More information about the R-SIG-GUI mailing list