File: tk2tip.Rd

package info (click to toggle)
r-cran-tcltk2 1.2-10-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,356 kB
  • ctags: 1,386
  • sloc: tcl: 37,888; ansic: 792; python: 324; sh: 68; sed: 16; makefile: 1
file content (74 lines) | stat: -rwxr-xr-x 2,195 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
\name{tk2tip}
\alias{tk2tip}
\alias{tk2killtip}
\alias{tip}
\alias{tip.tk2widget}
\alias{tip<-}
\alias{tip<-.tk2widget}

\title{ Display and manage tooltips in Tk widgets }
\description{
  \code{tk2tip} provides a simple mechanism to display tooltips on Tk widgets
  when the mouses hoover on top of them.
}

\usage{
tk2tip(widget, message)
tk2killtip()
tip(x, \dots)
\method{tip}{tk2widget}(x, \dots)
tip(x) <- value
\method{tip}{tk2widget}(x) <- value
}

\arguments{
  \item{widget}{ the widget to which a tooltip is attached. }
  \item{message}{ the message of the tooltip (\code{""} to remove the tooltip). }
  \item{x}{ a tk2widget object. }
  \item{\dots}{ further arguments to the method (unused, but reserved for
    future use). }
  \item{value}{ the message of the tooltip, or \code{""} to remove the tip. }
}

\author{ Philippe Grosjean }

\note{ This implementation is done in pure Tcl code }

\seealso{ \code{\link{tk2widgets}}, \code{\link{tk2methods}} }

\examples{
\dontrun{
## These cannot be run by examples() but should be OK when pasted
## into an interactive R session with the tcltk package loaded

## Using plain Tcl/Tk label and button (tk2XXX equivalent have built-in
## tooltip features)
tt <- tktoplevel()
lb <- tklabel(tt, text = "Move mouse over me, or over the button to see tooltip")
tkgrid(lb)
tk2tip(lb, "A tooltip for the label \ndisplayed on two lines")
but <- tkbutton(tt, text = "Exit", width = 10,
    command = function() tkdestroy(tt2))
tkgrid(but)
tk2tip(but, "Exit from this dialog box")
    
## To test tk2killtip(), move mouse on top of a widget
## so that the tip is visible, and force killing it manually using:
tk2killtip()
## Move again to the widget: the tip is displayed again.

## With tk2widgets, the tip() method can also be used:
lb2 <- tk2label(tt, text = "Move also over me to see the tooltip")
tkgrid(lb2)
tip(lb2) # No tip yet
tip(lb2) <- "Now the tooltip is there!"
## Move the mouse over that last label

tip(lb2) # Yes, this is my tooltip
tip(lb2) <- NULL # To eliminate the toltip for this widget
}
}

\keyword{ utilities }

\concept{ Tcl/Tk widget tooltip }