1tooltip(n)                    Tooltip management                    tooltip(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       tooltip - Tooltip management
9

SYNOPSIS

11       package require Tcl  8.4
12
13       package require msgcat  1.3
14
15       package require tooltip  ?1.4.4?
16
17       ::tooltip::tooltip command ?options?
18
19       ::tooltip::tooltip pathName ?option arg? message
20
21______________________________________________________________________________
22

DESCRIPTION

24       This  package  provides  tooltips, small text messages that can be dis‐
25       played when the mouse hovers over a widget,  menu  item,  canvas  item,
26       listbox item or text widget tag.
27

COMMANDS

29       ::tooltip::tooltip command ?options?
30              Manage the tooltip package using the following subcommands.
31
32              clear index
33                     Prevents  the  specified  widgets  from showing tooltips.
34                     pattern is a glob pattern and defaults  to  matching  all
35                     widgets.
36
37              delay ?millisecs?
38                     Query  or  set the hover delay. This is the interval that
39                     the pointer  must  remain  over  the  widget  before  the
40                     tooltip is displayed. The delay is specified in millisec‐
41                     onds and must be greater than 50ms.  With no argument the
42                     current delay is returned.
43
44              fade ?boolean?
45                     Enable  or disable fading of the tooltip.  The is enabled
46                     by default on Win32 and Aqua.  The tooltip will fade away
47                     on Leave events instead disappearing.
48
49              disable
50
51              off    Disable all tooltips
52
53              enable
54
55              on     Enables tooltips for defined widgets.
56
57
58       ::tooltip::tooltip pathName ?option arg? message
59              This  command  arranges for widget pathName to display a tooltip
60              with message message.  The tooltip uses  a  late-binding  msgcat
61              call  on  the passed in message to allow for on-the-fly language
62              changes in an application.  If the widget specified is  a  menu,
63              canvas  or  text  widget then additional options are used to tie
64              the tooltip to specific menu entries, canvas items or text tags.
65
66              -index index
67                     This option is used to set a tooltip on a menu item.  The
68                     index  may  be either the entry index or the entry label.
69                     The widget must be a menu widget but the entries  do  not
70                     have to exists when the tooltip is set.
71
72              -items name
73                     This option is used to set a tooltip for canvas widget or
74                     listbox items.  For the canvas widget, the item must  al‐
75                     ready  be  present in the canvas widget and will be found
76                     with a find withtag  lookup.   For  listbox  widgets  the
77                     item(s)  may  be  created later but the programmer is re‐
78                     sponsible for managing the link between the listbox  item
79                     index and the corresponding tooltip. If the listbox items
80                     are re-ordered, the tooltips will need amending.
81
82                     If the widget is not a canvas or listbox then an error is
83                     raised.
84
85              -tag name
86                     The  -tag  option can be used to set a tooltip for a text
87                     widget tag. The tag should already be present  when  this
88                     command  is called or an error will be returned. The wid‐
89                     get must also be a text widget.
90

EXAMPLE

92              # Demonstrate widget tooltip
93              package require tooltip
94              pack [label .l -text "label"]
95              tooltip::tooltip .l "This is a label widget"
96
97
98
99              # Demonstrate menu tooltip
100              package require tooltip
101              . configure -menu [menu .menu]
102              .menu add cascade -label Test -menu [menu .menu.test -tearoff 0]
103              .menu.test add command -label Tooltip
104              tooltip::tooltip .menu.test -index 0 "This is a menu tooltip"
105
106
107
108              # Demonstrate canvas item tooltip
109              package require tooltip
110              pack [canvas .c]
111              set item [.c create rectangle 10 10 80 80]
112              tooltip::tooltip .c -item $item "Canvas item tooltip"
113
114
115
116              # Demonstrate listbox item tooltip
117              package require tooltip
118              pack [listbox .lb]
119              .lb insert 0 "item one"
120              tooltip::tooltip .lb -item 0 "Listbox item tooltip"
121
122
123
124              # Demonstrate text tag tooltip
125              package require tooltip
126              pack [text .txt]
127              .txt tag configure TIP-1 -underline 1
128              tooltip::tooltip .txt -tag TIP-1 "tooltip one text"
129              .txt insert end "An example of a " {} "tooltip" TIP-1 " tag.\n" {}
130
131

KEYWORDS

133       balloon, help, hover, tooltip
134
136       Copyright (c) 1996-2008, Jeffrey Hobbs
137
138
139
140
141tooltip                              1.4.4                          tooltip(n)
Impressum