[R] Enhancement request for bringToTop()

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 19 07:50:49 CEST 2008


R-devel is the list for enhancement requests.

On Tue, 19 Aug 2008, Richard M. Heiberger wrote:

> Currently (R-2.7.1 on Windows)
>   bringToTop(stay=TRUE)
> when run before a device is opened, gives the error message
>> bringToTop(stay=TRUE)
> Error in bringToTop(stay = TRUE) :
>  can only bring windows devices to the front
>>
>
> In the same circumstances, a call to par() opens a device.

But not necessarily a windows() device.

> My request is to modify bringToTop().  If bringToTop()
> determines that it is running in an interactive environment,
> then it could open a graphics window and honor the request
> to put the newly opened window on Top.

Only if the default graphics device were windows().  It could be Cairo(), 
for example.

bringToTop() applies to a device number, which defaults to dev.cur() which 
defaults to 1.  Unlike par() it is not confined to the current device.

You can very easily program what you seem to want.  E.g.

if(.Device == "null device") windows() else bringToTop()

or perhaps

if(.Device != "windows") windows() else bringToTop()

Normally opening a device brings it to the top: for Rterm users 
it might not but then bringToTop() may not either.


-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list