Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

focusWin

Set the Focus on a Particular Window


Description

Bring the specified window into focus, and set it as the active window. focusWin will fail to bring the window into focus if it is called from the R console, since the R console returns focus to itself once a function returns. However, it will work if focusWin is called as a result of calling a function from the GUI window. (i.e., pushing a button or any other widget that has a function argument).

Usage

focusWin(winName, winVal=TRUE)

Arguments

winName

name of window to focus

winVal

if TRUE, associate winName with the default window for setWinVal and getWinVal

Author(s)

Alex Couture-Beil, Vancouver Island University, Nanaimo BC

Examples

## Not run: 
local(envir=.PBSmodEnv,expr={
focus <- function() {
  winName <- getWinVal()$select;
  focusWin(winName);
  mess = paste("Calling focusWin(\"", winName, "\")\n",
    "getWinVal()$myvar = ", getWinVal()$myvar, "\n\n", sep="",collapse="")
  cat(mess); invisible()
}
#create three windows named win1, win2, win3
#each having three radio buttons, which are used to change the focus
for(i in 1:3) {
  winDesc <- c(
    paste('window onclose=closeWin name=win',i,' title="Win',i,'"', sep=''),
    paste('entry myvar ', i, sep=''),
    'radio name=select value=win1 text="one" function=focus mode=character',
    'radio name=select value=win2 text="two" function=focus mode=character',
    'radio name=select value=win3 text="three" function=focus mode=character');
  createWin(winDesc, astext=TRUE); };
})

## End(Not run)

PBSmodelling

GUI Tools Made Easy: Interact with Models and Explore Data

v2.68.8
GPL (>= 2)
Authors
Jon T. Schnute [aut], Alex Couture-Beil [aut], Rowan Haigh [aut, cre], Nicholas Boers [ctb], Anisa Egeli [ctb], A. R. Kronlund [ctb], Steve Martell [ctb], Norm Olsen [ctb]
Initial release
2019-03-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.