Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: 0970a92038
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (47 sloc) 1.501 kB
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
.so man.macros
.TH tk_popup n 4.0 Tk "Tk Built-In Commands"
'\" Note: do not modify the .SH NAME line immediately below!
tk_popup \- Post a popup menu
\fBtk_popup \fImenu x y \fR?\fIentry\fR?
This procedure posts a menu at a given position on the screen and
configures Tk so that the menu and its cascaded children can be
traversed with the mouse or the keyboard.
\fIMenu\fR is the name of a menu widget and \fIx\fR and \fIy\fR
are the root coordinates at which to display the menu.
If \fIentry\fR is omitted or an empty string, the
menu's upper left corner is positioned at the given point.
Otherwise \fIentry\fR gives the index of an entry in \fImenu\fR and
the menu will be positioned so that the entry is positioned over
the given point.
How to attach a simple popup menu to a widget.
# Create a menu
set m [menu .popupMenu]
$m add command \-label "Example 1" \-command bell
$m add command \-label "Example 2" \-command bell
# Create something to attach it to
pack [label .l \-text "Click me!"]
# Arrange for the menu to pop up when the label is clicked
bind .l <1> {\fBtk_popup\fR .popupMenu %X %Y}
bind(n), menu(n), tk_optionMenu(n)
menu, popup
'\" Local Variables:
'\" mode: nroff
'\" End:
Jump to Line
Something went wrong with that request. Please try again.