CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Path: gap4r8 / pkg / Browse / doc / chap5.txt
Views: 418346
1
2
5 Browsing Tables in GAP using ncurses –The Programming Interface
3
4
This chapter describes some aspects of the internals of the browse table
5
handling. The relevant objects are action functions that implement the
6
individual navigation steps (see Section 5.1), modes that describe the sets
7
of available navigation steps in given situations (see Section 5.2), and
8
browse applications that are given by the combination of several modes (see
9
Section 5.3). Most of the related data is stored in the global variable
10
BrowseData (5.4-1). For more details, one should look directly at the code
11
in the file lib/browse.gi of the Browse package.
12
13
14
5.1 Navigation Steps in Browse Tables
15
16
Navigating in a browse table means that after entering visual mode by
17
calling NCurses.BrowseGeneric (4.3-1), the user hits one or several keys, or
18
uses a mouse button, and if this input is in a given set of admissible
19
inputs then a corresponding function is executed with argument the browse
20
table (plus additional information in the case of mouse events). The
21
function call then may change components in this table (recommended:
22
components in its dynamic component), such that the appearance in the window
23
may be different afterwards, and also the admissible inputs and their
24
effects may have changed.
25
26
The relation between the admissible inputs and the corresponding functions
27
is application dependent. However, it is recommended to associate the same
28
input to the same function in different situations; for example, the ? key
29
and the F1 key should belong to a function that shows a help window (see
30
Section 5.4-4), the q key and the Esc key should belong to a function that
31
exits the current mode (Note that the Esc key may be recognized as input
32
only after a delay of about a second.), the Q key should belong to a
33
function that exits the browse application (see Section 5.4-6), the F2 key
34
should belong to a function that saves the current window contents in a
35
global variable (see Section 5.4-5), and the E key should belong to a
36
function that enters a break loop (see Section 5.4-7). The Enter and Return
37
keys should belong to a click on a selected table entry, and if a category
38
row is selected then they should expand/collapse this category. The M key
39
should toggle enabling and disabling mouse events. Mouse events on a cell or
40
on a category row of a browse table should move the selected entry to this
41
position; it is recommended that no functionality is lost if no mouse events
42
are used, although the number of steps might be reduced when the mouse is
43
used.
44
45
Each such function is wrapped into a record with the components action (the
46
function itself) and helplines (a list of attribute lines that describes
47
what the function does). The help lines are used by the help feature of
48
NCurses.BrowseGeneric, see Section 5.4-4.
49
50
The action functions need not return anything. Whenever the shown screen
51
shall be recomputed after the function call, the component dynamic.changed
52
of the browse table must be set to true by the action functions.
53
54
After entering the first characters of an admissible input that consists of
55
more characters, the last line of the window with the browse table shows
56
these characters behind the prefix partial input:. One can delete the last
57
entered character of a partial input via the Delete and Backspace keys. It
58
is not possible to make these keys part of an admissible input. When a
59
partial input is given, only those user inputs have an effect that extend
60
the partial input to (a prefix of) an admissible input. For example, asking
61
for help by hitting the ? key will in general not work if a partial input
62
had been entered before.
63
64
65
5.2 Modes in Browse Tables
66
67
In different situations, different inputs may be admissible for the same
68
browse table, and different functions may belong to the same input. For
69
example, the meaning of moving down can be different depending on whether a
70
cell is selected or not.
71
72
The set of admissible user inputs and corresponding functions for a
73
particular situation is collected in a mode of the browse table. (There
74
should be no danger to mix up this notion of mode with the visual mode
75
introduced in Section 1.1.) A mode is represented by a record with the
76
components name (a string used to associate the mode with the components of
77
header, headerLength, footer, footerLength, Click, and for the help screen),
78
flag (a string that describes properties of the mode but that can be equal
79
for different modes), actions (a list of records describing the navigation
80
steps that are admissible in the mode, see Section 5.1), and ShowTables (the
81
function used to eventually print the current window contents, the default
82
is BrowseData.ShowTables). Due to the requirement that each admissible user
83
input uniquely determines a corresponding function, no admissible user input
84
can be a prefix of another admissible input, for the same mode.
85
86
Navigation steps (see Section 5.1) can change the current mode or keep the
87
mode. It is recommended that each mode has an action to leave this mode;
88
also an action to leave the browse table application is advisable.
89
90
In a browse table, all available modes are stored in the component
91
work.availableModes, whose value is a list of mode records. The value of the
92
component dynamic.activeModes is a list of mode records that is used as a
93
stack: The current mode is the last entry in this list, changing the current
94
mode is achieved by unbinding the last entry (so one returns to the mode
95
from which the current mode had been entered by adding it to the list), by
96
adding a new mode record (so one can later return to the current mode), or
97
by replacing the last entry by another mode record. As soon as the
98
dynamic.activeModes list becomes empty, the browse table application is
99
left. (In this situation, if the browse table had been entered from the GAP
100
prompt then visual mode is left, and one returns to the GAP prompt.)
101
102
The following modes are predefined by the Browse package. Each of these
103
modes admits the user inputs ?, F1, q, Esc, Q, F2, E, and M that have been
104
mentioned in Section 5.1.
105
106
browse
107
This mode admits scrolling of the browse table by a cell or by a
108
screen, searching for a string, selecting a row, a column, or an
109
entry, and expanding or collapsing all category rows.
110
111
help
112
This mode is entered by calling BrowseData.ShowHelpTable; it shows a
113
help window concerning the actions available in the mode from which
114
the help mode was entered. The help mode admits scrolling in the help
115
table by a cell or by a screen. See Section 5.4-4 for details.
116
117
select_entry
118
In this mode, one table cell is regarded as selected; this cell is
119
highlighted using the attribute in the component work.startSelect as a
120
prefix of each attribute line, see the remark in Section 2.2-3. The
121
mode admits moving the selection by one cell in the four directions,
122
searching for a string and for further occurrences of this string,
123
expanding or collapsing the current category row or all category rows,
124
and executing the click function of this mode, provided that the
125
component work.Click.( "select_entry" ) of the browse table is bound.
126
127
select_row
128
This is like the select_entry mode, except that a whole row of the
129
browse table is highlighted. Searching is restricted to the selected
130
row, and click refers to the function work.Click.( "select_row" ).
131
132
select_row_and_entry
133
This is a combination of the select_entry mode and the select_row
134
mode.
135
136
select_column
137
This is like the select_row mode, just a column is selected not a row.
138
139
select_column_and_entry
140
This is like the select_row_and_entry mode, just a column is selected
141
not a row.
142
143
144
5.3 Browse Applications
145
146
The data in a browse table together with the set of its available modes and
147
the stack of active modes forms a browse application. So the part of or all
148
functionality of the Browse package can be available (standard application),
149
or additional functionality can be provided by extending available modes or
150
adding new modes.
151
152
When NCurses.BrowseGeneric (4.3-1) has been called with the browse table t,
153
say, the following loop is executed.
154
155
1 If the list t.dynamic.activeModes is empty then exit the browse table,
156
and if the component t.dynamic.Return is bound then return its value.
157
Otherwise proceed with step 2.
158
159
2 If t.dynamic.changed is true then call the ShowTables function of the
160
current mode; this causes a redraw of the window that shows the browse
161
table. Then go to step 3.
162
163
3 Get one character of user input. If then the current user input string
164
is the name of an action of the current mode then call the
165
corresponding action function and go to step 1; if the current user
166
input string is just a prefix of the name of some actions of the
167
current mode then go to step 3; if the current user input string is
168
not a prefix of any name of an action of the current mode then discard
169
the last read character and go to step 3.
170
171
When one designs a new application, it may be not obvious whether some
172
functionality shall be implemented via one mode or via several modes. As a
173
rule of thumb, introducing a new mode is recommended when one needs a new
174
set of admissible actions in a given situation, and also if one wants to
175
allow the user to perform some actions and then to return to the previous
176
status.
177
178
179
5.4 Predefined Browse Functionalities
180
181
5.4-1 BrowseData
182
183
BrowseData global variable
184
185
This is the record that contains the global data used by the function
186
NCurses.BrowseGeneric (4.3-1). The components are actions, defaults, and
187
several capitalized names for which the values are functions.
188
189
BrowseData.actions is a record containing the action records that are
190
provided by the package, see Section 5.1. These actions are used in standard
191
applications of NCurses.BrowseGeneric (4.3-1). Of course there is no problem
192
with using actions that are not stored in BrowseData.actions.
193
194
BrowseData.defaults is a record that contains the defaults for the browse
195
table used as the first argument of NCurses.BrowseGeneric (4.3-1). Important
196
components have been described above, see BrowseData.IsBrowseTable (4.2-3),
197
in the sense that these components provide default values of work components
198
in browse tables. Here is a list of further interesting components.
199
200
The following components are provided in BrowseData.defaults.work.
201
202
windowParameters
203
is a list of four nonnegative integers, denoting the arguments of
204
NCurses.newwin for the window in which the browse table shall be
205
shown. The default is [ 0, 0, 0, 0 ], i. e., the window for the browse
206
table is the full screen.
207
208
minyx
209
is a list of length two, the entries must be either nonnegative
210
integers, denoting the minimal number of rows and columns that are
211
required by the browse table, or unary functions that return these
212
values when they are applied to the browse table; this is interesting
213
for applications that do not support scrolling, or for applications
214
that may have large row or column labels tables. The default is a list
215
with two functions, the return value of the first function is the sum
216
of the heights of the table header, the column labels table, the first
217
table row, and the table footer, and the return value of the second
218
function is the sum of widths of the row labels table and the width of
219
the first column. (If the header/footer is given by a function then
220
this part of the table is ignored in the minyx default.) Note that the
221
conditions are checked only when NCurses.BrowseGeneric (4.3-1) is
222
called, not after later changes of the screen size in a running browse
223
table application.
224
225
align
226
is a substring of "bclt", which describes the alignment of the browse
227
table in the window. The meaning and the default are the same as for
228
BrowseData.IsBrowseTableCellData (4.2-1). (Of course this is relevant
229
only if the table is smaller than the window.)
230
231
headerLength
232
describes the lengths of the headers in the modes for which header
233
functions are provided. The value is a record whose component names
234
are names of modes and the corresponding components are nonnegative
235
integers. This component is ignored if the header component is unbound
236
or bound to a list, missing values are computed by calls to the
237
corresponding header function as soon as they are needed.
238
239
footerLength
240
corresponds to footer in the same way as headerLength to header.
241
242
Main
243
if bound to a function then this function can be used to compute
244
missing values for the component main; this way one can avoid
245
computing/storing all main values at the same time. The access to the
246
entries of the main matrix is defined as follows: If
247
mainFormatted[i][j] is bound then take it, if main[i][j] is bound then
248
take it and compute the formatted version, if Main is a function then
249
call it with arguments the browse table, i, and j, and compute the
250
formatted version, otherwise compute the formatted version of
251
work.emptyCell. (For the condition whether entries in mainFormatted
252
can be bound, see below in the description of the component
253
cacheEntries.)
254
255
cacheEntries
256
describes whether formatted values of the entries in the matrices
257
given by the components corner, labelsCol, labelsRow, main, and of the
258
corresponding row and column separators shall be stored in the
259
components cornerFormatted, labelsColFormatted, labelsRowFormatted,
260
and mainFormatted. The value must be a Boolean, the default is false;
261
it should be set to true only if the tables are reasonably small.
262
263
cornerFormatted
264
is a list of lists of formatted entries corresponding to the corner
265
component. Each entry is either an attribute line or a list of
266
attribute lines (with the same number of displayed characters), the
267
values can be computed from the input format with
268
BrowseData.FormattedEntry. The entries are stored in this component
269
only if the component cacheEntries has the value true. The default is
270
an empty list.
271
272
labelsColFormatted
273
corresponds to labelsCol in the same way as cornerFormatted to corner.
274
275
labelsRowFormatted
276
corresponds to labelsRow in the same way as cornerFormatted to corner.
277
278
mainFormatted
279
corresponds to main in the same way as cornerFormatted to corner.
280
281
m0
282
is the maximal number of rows in the column labels table. If this
283
value is not bound then it is computed from the components corner and
284
labelsCol.
285
286
n0
287
is the maximal number of columns in corner and labelsRow.
288
289
m
290
is the maximal number of rows in labelsRow and main. This value must
291
be set in advance if the values of main are computed using a Main
292
function, and if the number of rows in main is larger than that in
293
labelsRow.
294
295
n
296
is the maximal number of columns in labelsCol and main. This value
297
must be set in advance if the values of main are computed using a Main
298
function, and if the number of columns in main is larger than that in
299
labelsCol.
300
301
heightLabelsCol
302
is a list of 2 m0+ 1 nonnegative integers, the entry at position i is
303
the maximal height of the entries in the i-th row of cornerFormatted
304
and labelsColFormatted. Values that are not bound are computed on
305
demand from the table entries, with the function
306
BrowseData.HeightLabelsCol. (So if one knows the needed heights in
307
advance, it is advisable to set the values, in order to avoid that
308
formatted table entries are computed just for computing their size.)
309
The default is an empty list.
310
311
widthLabelsRow
312
is the corresponding list of 2 n0+ 1 maximal widths of entries in
313
cornerFormatted and labelsRowFormatted.
314
315
heightRow
316
is the corresponding list of 2 m+ 1 maximal heights of entries in
317
labelsRowFormatted and mainFormatted.
318
319
widthCol
320
is the corresponding list of 2 n+ 1 maximal widths of entries in
321
labelsColFormatted and mainFormatted.
322
323
emptyCell
324
is a table cell data object to be used as the default for unbound
325
positions in the four matrices. The default is the empty list.
326
327
sepCategories
328
is an attribute line to be used repeatedly as a separator below
329
expanded category rows. The default is the string "-".
330
331
startCollapsedCategory
332
is a list of attribute lines to be used as prefixes of unhidden but
333
collapsed category rows. For category rows of level i, the last bound
334
entry before the (i+1)-th position is used. The default is a list of
335
length one, the entry is the boldface variant of the string "> ", so
336
collapsed category rows on different levels are treated equally.
337
338
startExpandedCategory
339
is a list of attribute lines to be used as prefixes of expanded
340
category rows, analogously to startCollapsedCategory. The default is a
341
list of length one, the entry is the boldface variant of the string "*
342
", so expanded category rows on different levels are treated equally.
343
344
startSelect
345
is an attribute line to be used as a prefix of each attribute line
346
that belongs to a selected cell. The default is to switch the
347
attribute NCurses.attrs.STANDOUT on, see Section 2.1-7.
348
349
Click
350
is a record whose component names are names of available modes of the
351
browse table. The values are unary functions that take the browse
352
table as their argument. If the action Click is available in the
353
current mode and the corresponding input is entered then the function
354
in the relevant component of the Click record is called.
355
356
availableModes
357
is a list whose entries are the mode records that can be used when one
358
navigates through the browse table, see Section 5.2.
359
360
SpecialGrid
361
is a function that takes a browse table and a record as its arguments.
362
It is called by BrowseData.ShowTables after the current contents of
363
the window has been computed, and it is intended to draw an individual
364
grid into the table that fits better than anything that can be
365
specified in terms of row and column separators. (If other functions
366
than BrowseData.ShowTables are used in some modes of the browse table,
367
these functions must deal with this aspect themselves.) The default is
368
to do nothing.
369
370
The following components are provided in BrowseData.defaults.dynamic.
371
372
changed
373
is a Boolean that must be set to true by action functions whenever a
374
refresh of the window is necessary; it is automatically reset to false
375
after the refresh.
376
377
indexRow
378
is a list of positive integers. The entry k at position i means that
379
the k-th row in the mainFormatted table is shown as the i-th row. Note
380
that depending on the current status of the browse table, the rows of
381
mainFormatted (and of main) may be permuted, or it may even happen
382
that a row in mainFormatted is shown several times, for example under
383
different category rows. It is assumed (as a sort convention) that the
384
even positions in indexRow point to even numbers, and that the
385
subsequent odd positions (corresponding to the following separators)
386
point to the subsequent odd numbers. The default value is the list [
387
1, 2, ..., m ], where m is the number of rows in mainFormatted
388
(including the separator rows, so m is always odd).
389
390
indexCol
391
is the analogous list of positive integers that refers to columns.
392
393
topleft
394
is a list of four positive integers denoting the current topleft
395
position of the main table. The value [ i, j, k, l ] means that the
396
topleft entry is indexed by the i-th entry in indexRow, the j-th entry
397
in indexCol, and the k-th row and l-th column inside the corresponding
398
cell. The default is [ 1, 1, 1, 1 ].
399
400
isCollapsedRow
401
is a list of Booleans, of the same length as the indexRow value. If
402
the entry at position i is true then the i-th row is currently not
403
shown because it belongs to a collapsed category row. It is assumed
404
(as a hide convention) that the value at any even position equals the
405
value at the subsequent odd position. The default is that all entries
406
are false.
407
408
isCollapsedCol
409
is the corresponding list for indexCol.
410
411
isRejectedRow
412
is a list of Booleans. If the entry at position i is true then the
413
i-th row is currently not shown because it does not match the current
414
filtering of the table. Defaults, length, and hide convention are as
415
for isCollapsedRow.
416
417
isRejectedCol
418
is the corresponding list for indexCol.
419
420
isRejectedLabelsRow
421
is a list of Booleans. If the entry at position i is true then the
422
i-th column of row labels is currently not shown.
423
424
isRejectedLabelsCol
425
is the corresponding list for the column labels.
426
427
activeModes
428
is a list of mode records that are contained in the availableModes
429
list of the work component of the browse table. The current mode is
430
the last entry in this list. The default depends on the application,
431
BrowseData.defaults prescribes the list containing only the mode with
432
name component "browse".
433
434
selectedEntry
435
is a list [ i, j ]. If i = j = 0 then no table cell is selected,
436
otherwise i and j are the row and column index of the selected cell.
437
(Note that i and j are always even.) The default is [ 0, 0 ].
438
439
selectedCategory
440
is a list [ i, l ]. If i = l = 0 then no category row is selected,
441
otherwise i and l are the row index and the level of the selected
442
category row. (Note that i is always even.) The default is [ 0, 0 ].
443
444
searchString
445
is the last string for which the user has searched in the table. The
446
default is the empty string.
447
448
searchParameters
449
is a list of parameters that are modified by the function
450
BrowseData.SearchStringWithStartParameters. If one sets these
451
parameters in a search then these values hold also for subsequent
452
searches. So it may make sense to set the parameters to personally
453
preferred ones.
454
455
sortFunctionForColumnsDefault
456
is a function with two arguments used to compare two entries in the
457
same column of the main table (or two category row values). The
458
default is the operation \<. (Note that this default may be not
459
meaningful if some of the rows or columns contain strings representing
460
numbers.)
461
462
sortFunctionForRowsDefault
463
is the analogous function for comparing two entries in the same row of
464
the main table.
465
466
sortFunctionsForRows
467
is a list of comparison functions, if the i-th entry is bound then it
468
replaces the sortFunctionForRowsDefault value when the table is sorted
469
w.r.t. the i-th row.
470
471
sortFunctionsForColumns
472
is the analogous list of functions for the case that the table is
473
sorted w.r.t. columns.
474
475
sortParametersForRowsDefault
476
is a list of parameters for sorting the main table w.r.t. entries in
477
given rows, e. g., whether one wants to sort ascending or descending.
478
479
sortParametersForColumnsDefault
480
is the analogous list of parameters for sorting w.r.t. given columns.
481
In addition to the parameters for rows, also parameters concerning
482
category rows are available, e. g., whether the data columns that are
483
transformed into category rows shall be hidden afterwards or not.
484
485
sortParametersForRows
486
is a list that contains ar position i, if bound, a list of parameters
487
that shall replace those in sortParametersForRowsDefault when the
488
table is sorted w.r.t. the i-th row.
489
490
sortParametersForColumns
491
is the analogous list of parameters lists for sorting w.r.t. columns.
492
493
categories
494
describes the current category rows. The value is a list [ l_1, l_2,
495
l_3 ] where l_1 is a sorted list [ i_1, i_2, ..., i_k ] of positive
496
integers, l_2 is a list of length k where the j-th entry is a record
497
with the components pos (with value i_j), level (the level of the
498
category row), value (an attribute line to be shown), separator (the
499
separator below this category row is a repetition of this string),
500
isUnderCollapsedCategory (true if the category row is hidden because a
501
category row of an outer level is collapsed; note that in the false
502
case, the category row itself can be collapsed), isRejectedCategory
503
(true if the category row is hidden because none of th edata rows
504
below this category match the current filtering of the table); the
505
list l_3 contains the levels for which the category rows shall include
506
the numbers of data rows under these category rows. The default value
507
is [ [], [], [] ]. (Note that this hide convention makes sense mainly
508
if together with a hidden category row, also the category rows on
509
higher levels and the corresponding data rows are hidden –but this
510
property is not checked.) Category rows are computed with the
511
CategoryValues function in the work component of the browse table.
512
513
log
514
describes the session log which is currently written. The value is a
515
list of positive integers, representing the user inputs in the current
516
session. When GAP returns from a call to NCurses.BrowseGeneric
517
(4.3-1), one can access the log list of the user interactions in the
518
browse table as the value of its component dynamic.log.
519
520
If BrowseData.logStore had been set to true before
521
NCurses.BrowseGeneric (4.3-1) had been called then the list can also
522
be accessed as the value of BrowseData.log. If BrowseData.logStore is
523
unbound or has a value different from true then BrowseData.log is not
524
written. (This can be interesting in the case of browse table
525
applications where the user does not get access to the browse table
526
itself.)
527
528
replay
529
describes the non-interactive input for the current browse table. The
530
value is a record with the components logs (a dense list of records,
531
the default is an empty list) and pointer (a positive integer, the
532
default is 1). If pointer is a position in logs then currently the
533
pointer-th record is processed, otherwise the browse table has
534
exhausted its non-interactive part, and requires interactive input.
535
The records in log have the components steps (a list of user inputs,
536
the default is an empty list), position (a positive integer denoting
537
the current position in the steps list if the log is currently
538
processed, the default is 1), replayInterval (the timeout between two
539
steps in milliseconds if the log is processed, the default is 0), and
540
quiet (a Boolean, true if the steps shall not be shown on the screen
541
until the end of the log is reached, the default is false).
542
543
5.4-2 BrowseData.SetReplay
544
545
BrowseData.SetReplay( data )  function
546
547
This function sets and resets the value of
548
BrowseData.defaults.dynamic.replay.
549
550
When BrowseData.SetReplay is called with a list data as its argument then
551
the entries are assumed to describe user inputs for a browse table for which
552
NCurses.BrowseGeneric (4.3-1) will be called afterwards, such that replay of
553
the inputs runs. (Valid input lists can be obtained from the component
554
dynamic.log of the browse table in question.)
555
556
When BrowseData.SetReplay is called with the only argument false, the
557
component is unbound (so replay is disabled, and thus calls to
558
NCurses.BrowseGeneric (4.3-1) will require interactive user input).
559
560
The replay feature should be used by initially setting the input list, then
561
running the replay (perhaps several times), and finally unbinding the
562
inputs, such that subsequent uses of other browse tables do not erroneously
563
expect their input in BrowseData.defaults.dynamic.replay.
564
565
Note that the value of BrowseData.defaults.dynamic.replay is used in a call
566
to NCurses.BrowseGeneric (4.3-1) only if the browse table in question does
567
not have a component dynamic.replay before the call.
568
569
5.4-3 BrowseData.AlertWithReplay
570
571
BrowseData.AlertWithReplay( t, messages[, attrs] )  function
572
Returns: an integer representing a (simulated) user input.
573
574
The function BrowseData.AlertWithReplay is a variant of NCurses.Alert
575
(3.1-1) that is adapted for the replay feature of the browse table t, see
576
Section 4.1. The arguments messages and attrs are the same as the
577
corresponding arguments of NCurses.Alert (3.1-1), the argument timeout of
578
NCurses.Alert (3.1-1) is taken from the browse table t, as follows. If
579
BrowseData.IsDoneReplay returns true for t then timeout is zero, so a user
580
input is requested for closing the alert box; otherwise the requested input
581
character is fetched from t.dynamic.replay.
582
583
If timeout is zero and mouse events are enabled (see NCurses.UseMouse
584
(2.2-10)) then the box can be moved inside the window via mouse events.
585
586
No alert box is shown if BrowseData.IsQuietSession returns true when called
587
with t.dynamic.replay, otherwise the alert box is closed after the time (in
588
milliseconds) that is given by the replayInterval value of the current entry
589
in t.dynamic.replay.logs.
590
591
The function returns either the return value of the call to NCurses.Alert
592
(3.1-1) (in the interactive case) or the value that was fetched from the
593
current replay record (in the replay case).
594
595
5.4-4 BrowseData.actions.ShowHelp
596
597
BrowseData.actions.ShowHelp global variable
598
599
There are two predefined ways for showing an overview of the admissible
600
inputs and their meaning in the current mode of a browse table. The function
601
BrowseData.ShowHelpTable displays this overview in a browse table (using the
602
help mode), and BrowseData.ShowHelpPager uses NCurses.Pager.
603
604
Technically, the only difference between these two functions is that
605
BrowseData.ShowHelpTable supports the replay feature of
606
NCurses.BrowseGeneric (4.3-1), whereas BrowseData.ShowHelpPager simply does
607
not call the pager in replay situations.
608
609
The action record BrowseData.actions.ShowHelp is associated with the user
610
inputs ? or F1 in standard NCurses.BrowseGeneric (4.3-1) applications, and
611
it is recommended to do the same in other NCurses.BrowseGeneric (4.3-1)
612
applications. This action calls the function stored in the component
613
work.ShowHelp of the browse table, the default (i. e., the value of
614
BrowseData.defaults.work.ShowHelp) is BrowseData.ShowHelpTable.
615
616
 Example 
617
gap> xpl1.work.ShowHelp:= BrowseData.ShowHelpPager;;
618
gap> BrowseData.SetReplay( "?Q" );
619
gap> Unbind( xpl1.dynamic );
620
gap> NCurses.BrowseGeneric( xpl1 );
621
gap> xpl1.work.ShowHelp:= BrowseData.ShowHelpTable;;
622
gap> BrowseData.SetReplay( "?dQQ" );
623
gap> Unbind( xpl1.dynamic );
624
gap> NCurses.BrowseGeneric( xpl1 );
625
gap> BrowseData.SetReplay( false );
626
gap> Unbind( xpl1.dynamic );
627

628
629
5.4-5 BrowseData.actions.SaveWindow
630
631
BrowseData.actions.SaveWindow global variable
632
633
The function BrowseData.actions.SaveWindow.action asks the user to enter the
634
name of a global GAP variable, using NCurses.GetLineFromUser (3.1-3). If
635
this variable name is valid and if no value is bound to this variable yet
636
then the current contents of the window of the browse table that is given as
637
the argument is saved in this variable, using NCurses.SaveWin (2.2-11).
638
639
5.4-6 BrowseData.actions.QuitMode
640
641
BrowseData.actions.QuitMode global variable
642
BrowseData.actions.QuitTable global variable
643
644
The function BrowseData.actions.QuitMode.action unbinds the current mode in
645
the browse table that is given as its argument (see Section 5.2), so the
646
browse table returns to the mode from which this mode had been called. If
647
the current mode is the only one, first the user is asked for confirmation
648
whether she really wants to quit the table; only if the y key is hit, the
649
last mode is unbound.
650
651
The function BrowseData.actions.QuitTable.action unbinds all modes in the
652
browse table that is given as its argument, without asking for confirmation;
653
the effect is to exit the browse application (see Section 5.3).
654
655
5.4-7 BrowseData.actions.Error
656
657
BrowseData.actions.Error global variable
658
659
After NCurses.BrowseGeneric (4.3-1) has been called, interrupting by hitting
660
the Ctrl-C keys is not possible. It is recommended to provide the action
661
BrowseData.actions.Error for each mode of a NCurses.BrowseGeneric (4.3-1)
662
application, which enters a break loop and admits returning to the
663
application. The recommended user input for this action is the E key.
664
665
666