[R] how do I return "focus" to console window

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jun 20 13:03:51 CEST 2001

On Wed, 20 Jun 2001 tomsv193 at student.liu.se wrote:

> Hi!
> I am creating a tool for adjustments of a special kind of datasets. I
> am plotting these dataset, and after a plot the program needs
> information from the user (via readline("1: approve 2: disapprove > ").
> Everything works fine apart from the fact that I have to click (with
> the mouse) on the console-window before I can gice the program its
> input. That is a bit annoying. The question is: how can I arrange it so
> that I only have to press the key (that is: that the console-windows
> is "active" - in some sense - after a plot)
> I am using R 1.2.3 on WinNT...

This is down to the details of your setup: which interface (MDI or SDI)
and how Windows is controlling the pointer, and so on.  I don't see a
focus shift except when a graphics window is first launched, and that is
deliberate (to bring it to the front).  So I can't tell you how to solve
something I never see.

There is a function bringToTop() to do the reverse, to give focus to the
graphics window.  You could probably modify it to do what you want:
if you do please contribute the modification.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list