1term::interact::menu(n) Terminal control term::interact::menu(n)
2
3
4
5______________________________________________________________________________
6
8 term::interact::menu - Terminal widget, menu
9
11 package require Tcl 8.4
12
13 package require term::interact::menu ?0.1?
14
15 term::interact::menu object dict ?options...?
16
17 object interact
18
19 object done
20
21 object clear
22
23 object configure
24
25 object configure option
26
27 object configure option value...
28
29 object cget option
30
31_________________________________________________________________
32
34 This package provides a class for the creation of a simple menu con‐
35 trol.
36
38 The package exports a single command, the class command, enabling the
39 creation of menu instances. Its API is:
40
41 term::interact::menu object dict ?options...?
42 This command creates a new menu object with the name object,
43 initializes it, and returns the fully qualified name of the
44 object command as its result.
45
46 The argument is the menu to show, possibly followed by configu‐
47 ration options and their values. The options are explained in
48 the section Configuration. The menu is a dictionary maping
49 labels to symbolic action codes.
50
52 The objects created by the class command provide the methods listed
53 below:
54
55 object interact
56 Shows the menu in the screen at the configured location and
57 starts interacting with it. This opens its own event loop for
58 the processing of incoming characters. The method returns when
59 the interaction has completed. See section Interaction for a
60 description of the possible interaction.
61
62 The method returns the symbolic action of the menu item selected
63 by the user at the end of the interaction.
64
65 object done
66 This method can be used by user supplied actions to terminate
67 the interaction with the object.
68
69 object clear
70 This method can be used by user supplied actions to remove the
71 menu from the terminal.
72
73 object configure
74
75 object configure option
76
77 object configure option value...
78
79 object cget option
80 Standard methods to retrieve and configure the options of the
81 menu.
82
84 A menu instance recognizes the following options:
85
86 -in chan
87 Specifies the channel to read character sequences from. Defaults
88 to stdin.
89
90 -out chan
91 Specifies the channel to write the menu contents to. Defaults to
92 stdout.
93
94 -column int
95 Specifies the column of the terminal where the left margin of
96 the menu display should appear. Defaults to 0, i.e. the left-
97 most column.
98
99 -line int
100 Specifies the line of the terminal where the top margin of the
101 menu display should appear. Defaults to 0, i.e. the top-most
102 line.
103
104 -height int
105 Specifies the number of lines of text to show at most in the
106 display. Defaults to 25.
107
108 -actions dict
109 Specifies a dictionary containing additional actions, using
110 character sequences as keys. Note that these sequences cannot
111 override the hardwired sequences described in section Interac‐
112 tion.
113
114 -hilitleft int
115
116 -hilitright int
117 By default the entire selected menu entry is highlighted in
118 revers output. However, when present these two options restrict
119 revers dispay to the specified sub-range of the entry.
120
121 -framed bool
122 By default the menu is shown using only header and footer out of
123 characters box graphics. If this flag is set the menu is fully
124 enclosed in a box.
125
127 A menu object recognizes the control sequences listed below and acts as
128 described. The user can supply more control sequences to act on via the
129 configuration, but is not able to overide these defaults.
130
131 Cursor Up
132 The selection is moved up one entry, except if the first entry
133 of the menu is already selected.
134
135 Cursor Down
136 The selection is moved down one entry, except if the last entry
137 of the menu is already selected.
138
139 Enter/Return
140 The interaction with the object is terminated.
141
143 control, menu, terminal, text display
144
146 Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
147
148
149
150
151term 0.1 term::interact::menu(n)