[1X5 Browsing Tables in [5XGAP[1X using [10Xncurses[1X âThe Programming Interface[0X This chapter describes some aspects of the internals of the browse table handling. The relevant objects are [13Xaction functions[0m that implement the individual navigation steps (see Section [14X5.1[0m), [13Xmodes[0m that describe the sets of available navigation steps in given situations (see Section [14X5.2[0m), and [13Xbrowse applications[0m that are given by the combination of several modes (see Section [14X5.3[0m). Most of the related data is stored in the global variable [2XBrowseData[0m ([14X5.4-1[0m). For more details, one should look directly at the code in the file [11Xlib/browse.gi[0m of the [5XBrowse[0m package. [1X5.1 Navigation Steps in Browse Tables[0X Navigating in a browse table means that after entering visual mode by calling [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m), the user hits one or several keys, or uses a mouse button, and if this input is in a given set of admissible inputs then a corresponding function is executed with argument the browse table (plus additional information in the case of mouse events). The function call then may change components in this table (recommended: components in its [10Xdynamic[0m component), such that the appearance in the window may be different afterwards, and also the admissible inputs and their effects may have changed. The relation between the admissible inputs and the corresponding functions is application dependent. However, it is recommended to associate the same input to the same function in different situations; for example, the [12X?[0m key and the [12XF1[0m key should belong to a function that shows a help window (see Section [14X5.4-4[0m), the [12Xq[0m key and the [12XEsc[0m key should belong to a function that exits the current mode (Note that the [12XEsc[0m key may be recognized as input only after a delay of about a second.), the [12XQ[0m key should belong to a function that exits the browse application (see Section [14X5.4-6[0m), the [12XF2[0m key should belong to a function that saves the current window contents in a global variable (see Section [14X5.4-5[0m), and the [12XE[0m key should belong to a function that enters a break loop (see Section [14X5.4-7[0m). The [12XEnter[0m and [12XReturn[0m keys should belong to a "click" on a selected table entry, and if a category row is selected then they should expand/collapse this category. The [12XM[0m key should toggle enabling and disabling mouse events. Mouse events on a cell or on a category row of a browse table should move the selected entry to this position; it is recommended that no functionality is lost if no mouse events are used, although the number of steps might be reduced when the mouse is used. Each such function is wrapped into a record with the components [10Xaction[0m (the function itself) and [10Xhelplines[0m (a list of attribute lines that describes what the function does). The help lines are used by the help feature of [10XNCurses.BrowseGeneric[0m, see Section [14X5.4-4[0m. The action functions need not return anything. Whenever the shown screen shall be recomputed after the function call, the component [10Xdynamic.changed[0m of the browse table must be set to [9Xtrue[0m by the action functions. After entering the first characters of an admissible input that consists of more characters, the last line of the window with the browse table shows these characters behind the prefix "partial input:". One can delete the last entered character of a partial input via the [12XDelete[0m and [12XBackspace[0m keys. It is not possible to make these keys part of an admissible input. When a partial input is given, only those user inputs have an effect that extend the partial input to (a prefix of) an admissible input. For example, asking for help by hitting the [12X?[0m key will in general not work if a partial input had been entered before. [1X5.2 Modes in Browse Tables[0X In different situations, different inputs may be admissible for the same browse table, and different functions may belong to the same input. For example, the meaning of "moving down" can be different depending on whether a cell is selected or not. The set of admissible user inputs and corresponding functions for a particular situation is collected in a [13Xmode[0m of the browse table. (There should be no danger to mix up this notion of mode with the "visual mode" introduced in Section [14X1.1[0m.) A mode is represented by a record with the components [10Xname[0m (a string used to associate the mode with the components of [10Xheader[0m, [10XheaderLength[0m, [10Xfooter[0m, [10XfooterLength[0m, [10XClick[0m, and for the help screen), [10Xflag[0m (a string that describes properties of the mode but that can be equal for different modes), [10Xactions[0m (a list of records describing the navigation steps that are admissible in the mode, see Section [14X5.1[0m), and [10XShowTables[0m (the function used to eventually print the current window contents, the default is [10XBrowseData.ShowTables[0m). Due to the requirement that each admissible user input uniquely determines a corresponding function, no admissible user input can be a prefix of another admissible input, for the same mode. Navigation steps (see Section [14X5.1[0m) can change the current mode or keep the mode. It is recommended that each mode has an action to leave this mode; also an action to leave the browse table application is advisable. In a browse table, all available modes are stored in the component [10Xwork.availableModes[0m, whose value is a list of mode records. The value of the component [10Xdynamic.activeModes[0m is a list of mode records that is used as a stack: The [13Xcurrent mode[0m is the last entry in this list, changing the current mode is achieved by unbinding the last entry (so one returns to the mode from which the current mode had been entered by adding it to the list), by adding a new mode record (so one can later return to the current mode), or by replacing the last entry by another mode record. As soon as the [10Xdynamic.activeModes[0m list becomes empty, the browse table application is left. (In this situation, if the browse table had been entered from the [5XGAP[0m prompt then visual mode is left, and one returns to the [5XGAP[0m prompt.) The following modes are predefined by the [5XBrowse[0m package. Each of these modes admits the user inputs [12X?[0m, [12XF1[0m, [12Xq[0m, [12XEsc[0m, [12XQ[0m, [12XF2[0m, [12XE[0m, and [12XM[0m that have been mentioned in Section [14X5.1[0m. [8Xbrowse[0m This mode admits scrolling of the browse table by a cell or by a screen, searching for a string, selecting a row, a column, or an entry, and expanding or collapsing all category rows. [8Xhelp[0m This mode is entered by calling [10XBrowseData.ShowHelpTable[0m; it shows a help window concerning the actions available in the mode from which the [10Xhelp[0m mode was entered. The [10Xhelp[0m mode admits scrolling in the help table by a cell or by a screen. See Section [14X5.4-4[0m for details. [8Xselect_entry[0m In this mode, one table cell is regarded as selected; this cell is highlighted using the attribute in the component [10Xwork.startSelect[0m as a prefix of each attribute line, see the remark in Section [14X2.2-3[0m. The mode admits moving the selection by one cell in the four directions, searching for a string and for further occurrences of this string, expanding or collapsing the current category row or all category rows, and executing the "click" function of this mode, provided that the component [10Xwork.Click.( "select_entry" )[0m of the browse table is bound. [8Xselect_row[0m This is like the [10Xselect_entry[0m mode, except that a whole row of the browse table is highlighted. Searching is restricted to the selected row, and "click" refers to the function [10Xwork.Click.( "select_row" )[0m. [8Xselect_row_and_entry[0m This is a combination of the [10Xselect_entry[0m mode and the [10Xselect_row[0m mode. [8Xselect_column[0m This is like the [10Xselect_row[0m mode, just a column is selected not a row. [8Xselect_column_and_entry[0m This is like the [10Xselect_row_and_entry[0m mode, just a column is selected not a row. [1X5.3 Browse Applications[0X The data in a browse table together with the set of its available modes and the stack of active modes forms a browse application. So the part of or all functionality of the [5XBrowse[0m package can be available ("standard application"), or additional functionality can be provided by extending available modes or adding new modes. When [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m) has been called with the browse table [3Xt[0m, say, the following loop is executed. [8X1.[0m If the list [3Xt[0m[10X.dynamic.activeModes[0m is empty then exit the browse table, and if the component [3Xt[0m[10X.dynamic.Return[0m is bound then return its value. Otherwise proceed with step 2. [8X2.[0m If [3Xt[0m[10X.dynamic.changed[0m is [9Xtrue[0m then call the [10XShowTables[0m function of the current mode; this causes a redraw of the window that shows the browse table. Then go to step 3. [8X3.[0m Get one character of user input. If then the current user input string is the name of an action of the current mode then call the corresponding action function and go to step 1; if the current user input string is just a prefix of the name of some actions of the current mode then go to step 3; if the current user input string is not a prefix of any name of an action of the current mode then discard the last read character and go to step 3. When one designs a new application, it may be not obvious whether some functionality shall be implemented via one mode or via several modes. As a rule of thumb, introducing a new mode is recommended when one needs a new set of admissible actions in a given situation, and also if one wants to allow the user to perform some actions and then to return to the previous status. [1X5.4 Predefined Browse Functionalities[0X [1X5.4-1 BrowseData[0m [2X> BrowseData_________________________________________________[0Xglobal variable This is the record that contains the global data used by the function [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m). The components are [10Xactions[0m, [10Xdefaults[0m, and several capitalized names for which the values are functions. [10XBrowseData.actions[0m is a record containing the action records that are provided by the package, see Section [14X5.1[0m. These actions are used in standard applications of [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m). Of course there is no problem with using actions that are not stored in [10XBrowseData.actions[0m. [10XBrowseData.defaults[0m is a record that contains the defaults for the browse table used as the first argument of [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m). Important components have been described above, see [2XBrowseData.IsBrowseTable[0m ([14X4.2-3[0m), in the sense that these components provide default values of [10Xwork[0m components in browse tables. Here is a list of further interesting components. The following components are provided in [10XBrowseData.defaults.work[0m. [8X[10XwindowParameters[0m[8X[0m is a list of four nonnegative integers, denoting the arguments of [10XNCurses.newwin[0m for the window in which the browse table shall be shown. The default is [10X[ 0, 0, 0, 0 ][0m, i. e., the window for the browse table is the full screen. [8X[10Xminyx[0m[8X[0m is a list of length two, the entries must be either nonnegative integers, denoting the minimal number of rows and columns that are required by the browse table, or unary functions that return these values when they are applied to the browse table; this is interesting for applications that do not support scrolling, or for applications that may have large row or column labels tables. The default is a list with two functions, the return value of the first function is the sum of the heights of the table header, the column labels table, the first table row, and the table footer, and the return value of the second function is the sum of widths of the row labels table and the width of the first column. (If the header/footer is given by a function then this part of the table is ignored in the [10Xminyx[0m default.) Note that the conditions are checked only when [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m) is called, not after later changes of the screen size in a running browse table application. [8X[10Xalign[0m[8X[0m is a substring of [10X"bclt"[0m, which describes the alignment of the browse table in the window. The meaning and the default are the same as for [2XBrowseData.IsBrowseTableCellData[0m ([14X4.2-1[0m). (Of course this is relevant only if the table is smaller than the window.) [8X[10XheaderLength[0m[8X[0m describes the lengths of the headers in the modes for which [10Xheader[0m functions are provided. The value is a record whose component names are names of modes and the corresponding components are nonnegative integers. This component is ignored if the [10Xheader[0m component is unbound or bound to a list, missing values are computed by calls to the corresponding [10Xheader[0m function as soon as they are needed. [8X[10XfooterLength[0m[8X[0m corresponds to [10Xfooter[0m in the same way as [10XheaderLength[0m to [10Xheader[0m. [8X[10XMain[0m[8X[0m if bound to a function then this function can be used to compute missing values for the component [10Xmain[0m; this way one can avoid computing/storing all [10Xmain[0m values at the same time. The access to the entries of the main matrix is defined as follows: If [10XmainFormatted[i][j][0m is bound then take it, if [10Xmain[i][j][0m is bound then take it and compute the formatted version, if [10XMain[0m is a function then call it with arguments the browse table, [10Xi[0m, and [10Xj[0m, and compute the formatted version, otherwise compute the formatted version of [10Xwork.emptyCell[0m. (For the condition whether entries in [10XmainFormatted[0m can be bound, see below in the description of the component [10XcacheEntries[0m.) [8X[10XcacheEntries[0m[8X[0m describes whether formatted values of the entries in the matrices given by the components [10Xcorner[0m, [10XlabelsCol[0m, [10XlabelsRow[0m, [10Xmain[0m, and of the corresponding row and column separators shall be stored in the components [10XcornerFormatted[0m, [10XlabelsColFormatted[0m, [10XlabelsRowFormatted[0m, and [10XmainFormatted[0m. The value must be a Boolean, the default is [9Xfalse[0m; it should be set to [9Xtrue[0m only if the tables are reasonably small. [8X[10XcornerFormatted[0m[8X[0m is a list of lists of formatted entries corresponding to the [10Xcorner[0m component. Each entry is either an attribute line or a list of attribute lines (with the same number of displayed characters), the values can be computed from the input format with [10XBrowseData.FormattedEntry[0m. The entries are stored in this component only if the component [10XcacheEntries[0m has the value [9Xtrue[0m. The default is an empty list. [8X[10XlabelsColFormatted[0m[8X[0m corresponds to [10XlabelsCol[0m in the same way as [10XcornerFormatted[0m to [10Xcorner[0m. [8X[10XlabelsRowFormatted[0m[8X[0m corresponds to [10XlabelsRow[0m in the same way as [10XcornerFormatted[0m to [10Xcorner[0m. [8X[10XmainFormatted[0m[8X[0m corresponds to [10Xmain[0m in the same way as [10XcornerFormatted[0m to [10Xcorner[0m. [8X[10Xm0[0m[8X[0m is the maximal number of rows in the column labels table. If this value is not bound then it is computed from the components [10Xcorner[0m and [10XlabelsCol[0m. [8X[10Xn0[0m[8X[0m is the maximal number of columns in [10Xcorner[0m and [10XlabelsRow[0m. [8X[10Xm[0m[8X[0m is the maximal number of rows in [10XlabelsRow[0m and [10Xmain[0m. This value [13Xmust[0m be set in advance if the values of [10Xmain[0m are computed using a [10XMain[0m function, and if the number of rows in [10Xmain[0m is larger than that in [10XlabelsRow[0m. [8X[10Xn[0m[8X[0m is the maximal number of columns in [10XlabelsCol[0m and [10Xmain[0m. This value [13Xmust[0m be set in advance if the values of [10Xmain[0m are computed using a [10XMain[0m function, and if the number of columns in [10Xmain[0m is larger than that in [10XlabelsCol[0m. [8X[10XheightLabelsCol[0m[8X[0m is a list of 2 [10Xm0[0m+ 1 nonnegative integers, the entry at position i is the maximal height of the entries in the i-th row of [10XcornerFormatted[0m and [10XlabelsColFormatted[0m. Values that are not bound are computed on demand from the table entries, with the function [10XBrowseData.HeightLabelsCol[0m. (So if one knows the needed heights in advance, it is advisable to set the values, in order to avoid that formatted table entries are computed just for computing their size.) The default is an empty list. [8X[10XwidthLabelsRow[0m[8X[0m is the corresponding list of 2 [10Xn0[0m+ 1 maximal widths of entries in [10XcornerFormatted[0m and [10XlabelsRowFormatted[0m. [8X[10XheightRow[0m[8X[0m is the corresponding list of 2 [10Xm[0m+ 1 maximal heights of entries in [10XlabelsRowFormatted[0m and [10XmainFormatted[0m. [8X[10XwidthCol[0m[8X[0m is the corresponding list of 2 [10Xn[0m+ 1 maximal widths of entries in [10XlabelsColFormatted[0m and [10XmainFormatted[0m. [8X[10XemptyCell[0m[8X[0m is a table cell data object to be used as the default for unbound positions in the four matrices. The default is the empty list. [8X[10XsepCategories[0m[8X[0m is an attribute line to be used repeatedly as a separator below expanded category rows. The default is the string [10X"-"[0m. [8X[10XstartCollapsedCategory[0m[8X[0m is a list of attribute lines to be used as prefixes of unhidden but collapsed category rows. For category rows of level i, the last bound entry before the (i+1)-th position is used. The default is a list of length one, the entry is the boldface variant of the string [10X"> "[0m, so collapsed category rows on different levels are treated equally. [8X[10XstartExpandedCategory[0m[8X[0m is a list of attribute lines to be used as prefixes of expanded category rows, analogously to [10XstartCollapsedCategory[0m. The default is a list of length one, the entry is the boldface variant of the string [10X"* "[0m, so expanded category rows on different levels are treated equally. [8X[10XstartSelect[0m[8X[0m is an attribute line to be used as a prefix of each attribute line that belongs to a selected cell. The default is to switch the attribute [10XNCurses.attrs.STANDOUT[0m on, see Section [14X2.1-7[0m. [8X[10XClick[0m[8X[0m is a record whose component names are names of available modes of the browse table. The values are unary functions that take the browse table as their argument. If the action [10XClick[0m is available in the current mode and the corresponding input is entered then the function in the relevant component of the [10XClick[0m record is called. [8X[10XavailableModes[0m[8X[0m is a list whose entries are the mode records that can be used when one navigates through the browse table, see Section [14X5.2[0m. [8X[10XSpecialGrid[0m[8X[0m is a function that takes a browse table and a record as its arguments. It is called by [10XBrowseData.ShowTables[0m after the current contents of the window has been computed, and it is intended to draw an individual grid into the table that fits better than anything that can be specified in terms of row and column separators. (If other functions than [10XBrowseData.ShowTables[0m are used in some modes of the browse table, these functions must deal with this aspect themselves.) The default is to do nothing. The following components are provided in [10XBrowseData.defaults.dynamic[0m. [8X[10Xchanged[0m[8X[0m is a Boolean that must be set to [9Xtrue[0m by action functions whenever a refresh of the window is necessary; it is automatically reset to [9Xfalse[0m after the refresh. [8X[10XuseMouse[0m[8X[0m is [9Xtrue[0m if mouse events are enabled in the browse application (see [2XNCurses.UseMouse[0m ([14X2.2-10[0m)), and [9Xfalse[0m otherwise, the default value is [9Xfalse[0m; an action in the table can change the value; when the browse application is left, [2XNCurses.UseMouse[0m ([14X2.2-10[0m) is called with argument [9Xfalse[0m; mouse events are disabled also in the break loop that is entered by the action in [2XBrowseData.actions.Error[0m ([14X5.4-7[0m). [8X[10XindexRow[0m[8X[0m is a list of positive integers. The entry k at position i means that the k-th row in the [10XmainFormatted[0m table is shown as the i-th row. Note that depending on the current status of the browse table, the rows of [10XmainFormatted[0m (and of [10Xmain[0m) may be permuted, or it may even happen that a row in [10XmainFormatted[0m is shown several times, for example under different category rows. It is assumed (as a "sort convention") that the [13Xeven[0m positions in [10XindexRow[0m point to [13Xeven[0m numbers, and that the subsequent [13Xodd[0m positions (corresponding to the following separators) point to the subsequent [13Xodd[0m numbers. The default value is the list [ 1, 2, ..., m ], where m is the number of rows in [10XmainFormatted[0m (including the separator rows, so m is always odd). [8X[10XindexCol[0m[8X[0m is the analogous list of positive integers that refers to columns. [8X[10Xtopleft[0m[8X[0m is a list of four positive integers denoting the current topleft position of the main table. The value [ i, j, k, l ] means that the topleft entry is indexed by the i-th entry in [10XindexRow[0m, the j-th entry in [10XindexCol[0m, and the k-th row and l-th column inside the corresponding cell. The default is [ 1, 1, 1, 1 ]. [8X[10XisCollapsedRow[0m[8X[0m is a list of Booleans, of the same length as the [10XindexRow[0m value. If the entry at position i is [9Xtrue[0m then the i-th row is currently not shown because it belongs to a collapsed category row. It is assumed (as a "hide convention") that the value at any even position equals the value at the subsequent odd position. The default is that all entries are [9Xfalse[0m. [8X[10XisCollapsedCol[0m[8X[0m is the corresponding list for [10XindexCol[0m. [8X[10XisRejectedRow[0m[8X[0m is a list of Booleans. If the entry at position i is [9Xtrue[0m then the i-th row is currently not shown because it does not match the current filtering of the table. Defaults, length, and hide convention are as for [10XisCollapsedRow[0m. [8X[10XisRejectedCol[0m[8X[0m is the corresponding list for [10XindexCol[0m. [8X[10XisRejectedLabelsRow[0m[8X[0m is a list of Booleans. If the entry at position i is [9Xtrue[0m then the i-th column of row labels is currently not shown. [8X[10XisRejectedLabelsCol[0m[8X[0m is the corresponding list for the column labels. [8X[10XactiveModes[0m[8X[0m is a list of mode records that are contained in the [10XavailableModes[0m list of the [10Xwork[0m component of the browse table. The current mode is the last entry in this list. The default depends on the application, [10XBrowseData.defaults[0m prescribes the list containing only the mode with [10Xname[0m component [10X"browse"[0m. [8X[10XselectedEntry[0m[8X[0m is a list [ i, j ]. If i = j = 0 then no table cell is selected, otherwise i and j are the row and column index of the selected cell. (Note that i and j are always even.) The default is [ 0, 0 ]. [8X[10XselectedCategory[0m[8X[0m is a list [ i, l ]. If i = l = 0 then no category row is selected, otherwise i and l are the row index and the level of the selected category row. (Note that i is always even.) The default is [ 0, 0 ]. [8X[10XsearchString[0m[8X[0m is the last string for which the user has searched in the table. The default is the empty string. [8X[10XsearchParameters[0m[8X[0m is a list of parameters that are modified by the function [10XBrowseData.SearchStringWithStartParameters[0m. If one sets these parameters in a search then these values hold also for subsequent searches. So it may make sense to set the parameters to personally preferred ones. [8X[10XsortFunctionForColumnsDefault[0m[8X[0m is a function with two arguments used to compare two entries in the same column of the main table (or two category row values). The default is the function [10X\<[0m. (Note that this default may be not meaningful if some of the rows or columns contain strings representing numbers.) [8X[10XsortFunctionForRowsDefault[0m[8X[0m is the analogous function for comparing two entries in the same row of the main table. [8X[10XsortFunctionsForRows[0m[8X[0m is a list of comparison functions, if the i-th entry is bound then it replaces the [10XsortFunctionForRowsDefault[0m value when the table is sorted w.r.t. the i-th row. [8X[10XsortFunctionsForColumns[0m[8X[0m is the analogous list of functions for the case that the table is sorted w.r.t. columns. [8X[10XsortParametersForRowsDefault[0m[8X[0m is a list of parameters for sorting the main table w.r.t. entries in given rows, e. g., whether one wants to sort ascending or descending. [8X[10XsortParametersForColumnsDefault[0m[8X[0m is the analogous list of parameters for sorting w.r.t. given columns. In addition to the parameters for rows, also parameters concerning category rows are available, e. g., whether the data columns that are transformed into category rows shall be hidden afterwards or not. [8X[10XsortParametersForRows[0m[8X[0m is a list that contains ar position i, if bound, a list of parameters that shall replace those in [10XsortParametersForRowsDefault[0m when the table is sorted w.r.t. the i-th row [8X[10XsortParametersForColumns[0m[8X[0m is the analogous list of parameters lists for sorting w.r.t. columns. [8X[10Xcategories[0m[8X[0m describes the current category rows. The value is a list [ l_1, l_2, l_3 ] where l_1 is a [13Xsorted[0m list [ i_1, i_2, ..., i_k ] of positive integers, l_2 is a list of length k where the j-th entry is a record with the components [10Xpos[0m (with value i_j), [10Xlevel[0m (the level of the category row), [10Xvalue[0m (an attribute line to be shown), [10Xseparator[0m (the separator below this category row is a repetition of this string), [10XisUnderCollapsedCategory[0m ([9Xtrue[0m if the category row is hidden because a category row of an outer level is collapsed; note that in the [9Xfalse[0m case, the category row itself can be collapsed), [10XisRejectedCategory[0m ([9Xtrue[0m if the category row is hidden because none of th edata rows below this category match the current filtering of the table); the list l_3 contains the levels for which the category rows shall include the numbers of data rows under these category rows. The default value is [10X[ [], [], [] ][0m. (Note that this "hide convention" makes sense mainly if together with a hidden category row, also the category rows on higher levels and the corresponding data rows are hidden âbut this property is [13Xnot[0m checked.) Category rows are computed with the [10XCategoryValues[0m function in the [10Xwork[0m component of the browse table. [8X[10Xlog[0m[8X[0m describes the session log which is currently written. The value is a list of positive integers, representing the user inputs in the current session. When [5XGAP[0m returns from a call to [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m), one can access the log list of the user interactions in the browse table as the value of its component [10Xdynamic.log[0m. If [10XBrowseData.logStore[0m had been set to [9Xtrue[0m before [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m) had been called then the list can also be accessed as the value of [10XBrowseData.log[0m. If [10XBrowseData.logStore[0m is unbound or has a value different from [9Xtrue[0m then [10XBrowseData.log[0m is not written. (This can be interesting in the case of browse table applications where the user does not get access to the browse table itself.) [8X[10Xreplay[0m[8X[0m describes the non-interactive input for the current browse table. The value is a record with the components [10Xlogs[0m (a dense list of records, the default is an empty list) and [10Xpointer[0m (a positive integer, the default is 1). If [10Xpointer[0m is a position in [10Xlogs[0m then currently the [10Xpointer[0m-th record is processed, otherwise the browse table has exhausted its non-interactive part, and requires interactive input. The records in [10Xlog[0m have the components [10Xsteps[0m (a list of user inputs, the default is an empty list), [10Xposition[0m (a positive integer denoting the current position in the [10Xsteps[0m list if the log is currently processed, the default is 1), [10XreplayInterval[0m (the timeout between two steps in milliseconds if the log is processed, the default is 0), and [10Xquiet[0m (a Boolean, [9Xtrue[0m if the steps shall not be shown on the screen until the end of the log is reached, the default is [9Xfalse[0m). [1X5.4-2 BrowseData.SetReplay[0m [2X> BrowseData.SetReplay( [0X[3Xdata[0X[2X ) _____________________________________[0Xfunction This function sets and resets the value of [10XBrowseData.defaults.dynamic.replay[0m. When [2XBrowseData.SetReplay[0m is called with a list [3Xdata[0m as its argument then the entries are assumed to describe user inputs for a browse table for which [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m) will be called afterwards, such that replay of the inputs runs. (Valid input lists can be obtained from the component [10Xdynamic.log[0m of the browse table in question.) When [2XBrowseData.SetReplay[0m is called with the only argument [9Xfalse[0m, the component is unbound (so replay is disabled, and thus calls to [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m) will require interactive user input). The replay feature should be used by initially setting the input list, then running the replay (perhaps several times), and finally unbinding the inputs, such that subsequent uses of other browse tables do not erroneously expect their input in [10XBrowseData.defaults.dynamic.replay[0m. Note that the value of [10XBrowseData.defaults.dynamic.replay[0m is used in a call to [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m) only if the browse table in question does not have a component [10Xdynamic.replay[0m before the call. [1X5.4-3 BrowseData.AlertWithReplay[0m [2X> BrowseData.AlertWithReplay( [0X[3Xt, messages[, attrs][0X[2X ) _______________[0Xfunction [6XReturns:[0X an integer representing a (simulated) user input. The function [2XBrowseData.AlertWithReplay[0m is a variant of [2XNCurses.Alert[0m ([14X3.1-1[0m) that is adapted for the replay feature of the browse table [3Xt[0m, see Section [14X4.1[0m. The arguments [3Xmessages[0m and [3Xattrs[0m are the same as the corresponding arguments of [2XNCurses.Alert[0m ([14X3.1-1[0m), the argument [10Xtimeout[0m of [2XNCurses.Alert[0m ([14X3.1-1[0m) is taken from the browse table [3Xt[0m, as follows. If [10XBrowseData.IsDoneReplay[0m returns [9Xtrue[0m for [10Xt[0m then [10Xtimeout[0m is zero, so a user input is requested for closing the alert box; otherwise the requested input character is fetched from [10Xt.dynamic.replay[0m. If [10Xtimeout[0m is zero and mouse events are enabled (see [2XNCurses.UseMouse[0m ([14X2.2-10[0m)) then the box can be moved inside the window via mouse events. No alert box is shown if [10XBrowseData.IsQuietSession[0m returns [9Xtrue[0m when called with [3Xt[0m[10X.dynamic.replay[0m, otherwise the alert box is closed after the time (in milliseconds) that is given by the [10XreplayInterval[0m value of the current entry in [3Xt[0m[10X.dynamic.replay.logs[0m. The function returns either the return value of the call to [2XNCurses.Alert[0m ([14X3.1-1[0m) (in the interactive case) or the value that was fetched from the current replay record (in the replay case). [1X5.4-4 BrowseData.actions.ShowHelp[0m [2X> BrowseData.actions.ShowHelp________________________________[0Xglobal variable There are two predefined ways for showing an overview of the admissible inputs and their meaning in the current mode of a browse table. The function [10XBrowseData.ShowHelpTable[0m displays this overview in a browse table (using the [10Xhelp[0m mode), and [10XBrowseData.ShowHelpPager[0m uses [10XNCurses.Pager[0m. Technically, the only difference between these two functions is that [10XBrowseData.ShowHelpTable[0m supports the replay feature of [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m), whereas [10XBrowseData.ShowHelpPager[0m simply does not call the pager in replay situations. The action record [10XBrowseData.actions.ShowHelp[0m is associated with the user inputs [12X?[0m or [12XF1[0m in standard [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m) applications, and it is recommended to do the same in other [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m) applications. This action calls the function stored in the component [10Xwork.ShowHelp[0m of the browse table, the default (i. e., the value of [10XBrowseData.defaults.work.ShowHelp[0m) is [10XBrowseData.ShowHelpTable[0m. [4X--------------------------- Example ----------------------------[0X [4Xgap> xpl1.work.ShowHelp:= BrowseData.ShowHelpPager;;[0X [4Xgap> BrowseData.SetReplay( "?Q" );[0X [4Xgap> Unbind( xpl1.dynamic );[0X [4Xgap> NCurses.BrowseGeneric( xpl1 );[0X [4Xgap> xpl1.work.ShowHelp:= BrowseData.ShowHelpTable;;[0X [4Xgap> BrowseData.SetReplay( "?dQQ" );[0X [4Xgap> Unbind( xpl1.dynamic );[0X [4Xgap> NCurses.BrowseGeneric( xpl1 );[0X [4Xgap> BrowseData.SetReplay( false );[0X [4Xgap> Unbind( xpl1.dynamic );[0X [4X------------------------------------------------------------------[0X [1X5.4-5 BrowseData.actions.SaveWindow[0m [2X> BrowseData.actions.SaveWindow______________________________[0Xglobal variable The function [10XBrowseData.actions.SaveWindow.action[0m asks the user to enter the name of a global [5XGAP[0m variable, using [2XNCurses.GetLineFromUser[0m ([14X3.1-3[0m). If this variable name is valid and if no value is bound to this variable yet then the current contents of the window of the browse table that is given as the argument is saved in this variable, using [2XNCurses.SaveWin[0m ([14X2.2-11[0m). [1X5.4-6 BrowseData.actions.QuitMode[0m [2X> BrowseData.actions.QuitMode________________________________[0Xglobal variable [2X> BrowseData.actions.QuitTable_______________________________[0Xglobal variable The function [10XBrowseData.actions.QuitMode.action[0m unbinds the current mode in the browse table that is given as its argument (see Section [14X5.2[0m), so the browse table returns to the mode from which this mode had been called. If the current mode is the only one, first the user is asked for confirmation whether she really wants to quit the table; only if the [12Xy[0m key is hit, the last mode is unbound. The function [10XBrowseData.actions.QuitTable.action[0m unbinds all modes in the browse table that is given as its argument, without asking for confirmation; the effect is to exit the browse application (see Section [14X5.3[0m). [1X5.4-7 BrowseData.actions.Error[0m [2X> BrowseData.actions.Error___________________________________[0Xglobal variable After [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m) has been called, interrupting by hitting the [12XCtrl-C[0m keys is not possible. It is recommended to provide the action [2XBrowseData.actions.Error[0m for each mode of a [2XNCurses.BrowseGeneric[0m ([14X4.3-1[0m) application, which enters a break loop and admits returning to the application. The recommended user input for this action is the [12XE[0m key.