1Popup(3) User Contributed Perl Documentation Popup(3)
2
3
4
6 Tk::Wm::Popup - popup dialog windows.
7
9 $dialog->Popup(qw/
10 -popover => 'cursor' ⎪ $widget ⎪ undef,
11 -overanchor => c ⎪ n ⎪ ne ⎪ e ⎪ se ⎪ s ⎪ sw ⎪ w ⎪ nw,
12 -popanchor => c ⎪ n ⎪ ne ⎪ e ⎪ se ⎪ s ⎪ sw ⎪ w ⎪ nw,
13 /);
14
16 You've probably had occasion to use a Dialog (or DialogBox) widget.
17 These widgets are derived from a Toplevel (which is a subclass of
18 Tk::Wm, the window manager) and spend most of their time in a withdrawn
19 state. It's also common to use Toplevels as containers for custom built
20 popup windows. Menus, too, are dialogs derived from the window manager
21 class. For this discussion, we'll use the simple term dialog to refer
22 any widget that pops up and awaits user interaction, whether it be a
23 Menu, a special purpose Toplevel, or any of the dialog-type widgets,
24 including, but not limited to, ColorEditor, Dialog, DialogBox, Error‐
25 Dialog, FileSelect, FBox, getOpenFile and getSaveFile.
26
27 When it's time to display these dialogs, we call the Perl/Tk window
28 manager Popup method. Popup accepts three special purpose options that
29 specify placement information in high-level terms rather than numerical
30 coordinates. It is Popup's responsibility to take our human specifica‐
31 tions and turn them into actual screen coordinates before displaying
32 the dialog.
33
34 We can direct the dialog to appear in two general locations, either
35 over another window (e.g. the root window (screen) or a particular wid‐
36 get), or over the cursor. This is called the popover location. Once
37 we've made this decision we can further refine the exact placement of
38 the dialog relative to the popover location by specifying the intersec‐
39 tion of two anchor points. The popanchor point is associated with the
40 dialog and the overanchor point is associated with the popover location
41 (whether it be a window or the cursor). The point where the two anchor
42 points coincide is the popup locus. Anchor points are string values and
43 can be c (for center), or any of the eight cardinal compass points: n,
44 ne, e, se, s, sw, w or nw.
45
46 For example, if -popover specifies a widget, -popanchor is sw, and
47 -overanchor is ne, the the dialog's southwest corner pops up at the
48 widget's northeast corner.
49
51 The options recognized by Popup are as follows:
52
53 -popover
54 Specifies whether the dialog "pops over" a window or the cursor.
55 It may be the string cursor, a widget reference, or undef for the
56 root window.
57
58 -popanchor
59 Specifies the anchor point of the dialog. For instance, if e is
60 specified, the right side of the dialog is the anchor.
61
62 -overanchor
63 Specifies where the dialog should anchor relative to the popover
64 location. For instance, if e is specified the dialog appears over
65 the right side of the popover location and if it's ne the the dia‐
66 log is positioned at the upper-right corner of the popover loca‐
67 tion.
68
70 Nick Ing-Simmons, Steve Lidie
71
72 This code is distributed under the same terms as Perl.
73
74
75
76perl v5.8.8 2008-02-05 Popup(3)