?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())) > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel > > -- Brian D. Ripley, [EMAIL PROTECTED] 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 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-devel