1% File src/library/utils/man/setWindowTitle.Rd
2% Part of the R package, https://www.R-project.org
3% Copyright 1995-2018 R Core Team
4% Distributed under GPL 2 or later
5
6\name{setWindowTitle}
7\alias{setWindowTitle}
8\alias{getWindowTitle}
9\alias{getIdentification}
10\alias{setStatusBar}
11\title{Set the Window Title or the Statusbar of the RGui in Windows}
12\description{
13  Set or get the title of the \R (i.e. \command{RGui}) window  which
14  will appear in the task bar, or set the statusbar (if in use).
15}
16\usage{
17setWindowTitle(suffix, title = paste(getIdentification(), suffix))
18
19getWindowTitle()
20
21getIdentification()
22
23setStatusBar(text)
24}
25\arguments{
26  \item{suffix}{a character string to form part of the title}
27  \item{title}{a character string forming the complete new title}
28  \item{text}{a character string of up to 255 characters, to be
29    displayed in the status bar.}
30}
31\details{
32  \code{setWindowTitle} appends \code{suffix} to the normal window
33  identification (\command{RGui}, \command{R Console} or
34  \command{Rterm}).  Use
35  \code{suffix = ""} to reset the title.
36
37  \code{getWindowTitle} gets the current title.
38
39  This sets the title of the frame in MDI mode, the title of the console
40  for \code{RGui --sdi}, and the title of the window from which it was
41  launched for \code{Rterm}.
42  It has no effect in embedded uses of \R.
43
44  \code{getIdentification} returns the normal window identification.
45
46  \code{setStatusBar} sets the text in the statusbar of an MDI
47  frame: if this is not currently shown it is selected and shown.
48}
49\value{
50  The first three functions return a length 1 character vector.
51
52  \code{setWindowTitle} returns the previous window title (invisibly).
53
54  \code{getWindowTitle} and \code{getIdentification} return the current
55  window title and the normal window identification, respectively.
56}
57\note{
58  These functions are only available on Windows and only make sense when
59  using the \command{Rgui}.  E.g., in \command{Rterm} (and hence in \command{ESS})
60  the title is not visible (but can be set and gotten), and in a version of
61  \command{RStudio} it has been \code{""}, invariably.
62}
63\examples{
64if(.Platform$OS.type == "windows") withAutoprint({
65## show the current working directory in the title, saving the old one
66oldtitle <- setWindowTitle(getwd())
67Sys.sleep(0.5)
68## reset the title
69setWindowTitle("")
70Sys.sleep(0.5)
71## restore the original title
72setWindowTitle(title = oldtitle)
73})% Windows-only
74}
75\keyword{utilities}
76