From ripley at stats.ox.ac.uk  Sun Nov  2 12:51:04 2003
From: ripley at stats.ox.ac.uk (Prof Brian D Ripley)
Date: Sun Nov  2 12:50:17 2003
Subject: [Rd] Windows RConsole Focus
In-Reply-To: <Pine.LNX.4.44.0310221856330.14211-100000@unix28.alpha.wehi.edu.au>
Message-ID: <Pine.WNT.4.44.0311021150370.856-100000@petrel>

?bringToTop

On Wed, 22 Oct 2003, James Wettenhall wrote:

> Hi,
>
> I was looking for a Windows-specific R function to focus the
> console window and couldn't find one.  The motivation is that
> after loading the tcltk package, the "main" Tk window "." is
> presumably focused but then immediately withdrawn (hidden) so
> the RConsole loses its focus and you have to click on it to
> continue typing.
>
> Would there be any interest in including a winConsoleFocus()
> function in R at some stage or is it already there?
>
> I tried implementing a quick solution (below) which seemes
> to work.
>
> Regards,
> James
>
> src/gnuwin32/rui.c
> ------------------
> int winconsolefocus()
> {
>     show(RConsole);
>     return 0;
> }
>
> src/gnuwin32/rui.h
> ------------------
> int winconsolefocus(void);
>
> src/gnuwin32/extra.c
> --------------------
> SEXP do_winconsolefocus(SEXP call, SEXP op, SEXP args, SEXP rho)
> {
>     SEXP ans;
>     Rboolean success = TRUE;
>     winconsolefocus();
>     PROTECT(ans = allocVector(LGLSXP, 1));
>     LOGICAL(ans)[0] = success;
>     UNPROTECT(1);
>     return ans;
> }
>
> src/main/names.c
> ----------------
> {"winConsoleFocus",do_winconsolefocus,0,11,     0,
> {PP_FUNCALL, PREC_FN,   0}},
>
> src/include/Internal.h
> ----------------------
> SEXP do_winconsolefocus(SEXP, SEXP, SEXP, SEXP);
>
> src/library/base/R/windows/winDialog.R
> ---------------------------------------
> winConsoleFocus <- function()
>     invisible(.Internal(winConsoleFocus()))
>
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley@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


[Rd] Windows RConsole Focus
Prof Brian D Ripley