Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
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
Project: cocalc-sagemath-dev-slelievre
Views: 4183461[1X5 [33X[0;0YBrowsing Tables in [5XGAP[105X[101X[1X using [10Xncurses[110X[101X[1X –The Programming Interface[133X[101X23[33X[0;0YThis chapter describes some aspects of the internals of the browse table4handling. The relevant objects are [13Xaction functions[113X that implement the5individual navigation steps (see Section [14X5.1[114X), [13Xmodes[113X that describe the sets6of available navigation steps in given situations (see Section [14X5.2[114X), and7[13Xbrowse applications[113X that are given by the combination of several modes (see8Section [14X5.3[114X). Most of the related data is stored in the global variable9[2XBrowseData[102X ([14X5.4-1[114X). For more details, one should look directly at the code10in the file [11Xlib/browse.gi[111X of the [5XBrowse[105X package.[133X111213[1X5.1 [33X[0;0YNavigation Steps in Browse Tables[133X[101X1415[33X[0;0YNavigating in a browse table means that after entering visual mode by16calling [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X), the user hits one or several keys, or17uses a mouse button, and if this input is in a given set of admissible18inputs then a corresponding function is executed with argument the browse19table (plus additional information in the case of mouse events). The20function call then may change components in this table (recommended:21components in its [10Xdynamic[110X component), such that the appearance in the window22may be different afterwards, and also the admissible inputs and their23effects may have changed.[133X2425[33X[0;0YThe relation between the admissible inputs and the corresponding functions26is application dependent. However, it is recommended to associate the same27input to the same function in different situations; for example, the [12X?[112X key28and the [12XF1[112X key should belong to a function that shows a help window (see29Section [14X5.4-4[114X), the [12Xq[112X key and the [12XEsc[112X key should belong to a function that30exits the current mode (Note that the [12XEsc[112X key may be recognized as input31only after a delay of about a second.), the [12XQ[112X key should belong to a32function that exits the browse application (see Section [14X5.4-6[114X), the [12XF2[112X key33should belong to a function that saves the current window contents in a34global variable (see Section [14X5.4-5[114X), and the [12XE[112X key should belong to a35function that enters a break loop (see Section [14X5.4-7[114X). The [12XEnter[112X and [12XReturn[112X36keys should belong to a [21Xclick[121X on a selected table entry, and if a category37row is selected then they should expand/collapse this category. The [12XM[112X key38should toggle enabling and disabling mouse events. Mouse events on a cell or39on a category row of a browse table should move the selected entry to this40position; it is recommended that no functionality is lost if no mouse events41are used, although the number of steps might be reduced when the mouse is42used.[133X4344[33X[0;0YEach such function is wrapped into a record with the components [10Xaction[110X (the45function itself) and [10Xhelplines[110X (a list of attribute lines that describes46what the function does). The help lines are used by the help feature of47[10XNCurses.BrowseGeneric[110X, see Section [14X5.4-4[114X.[133X4849[33X[0;0YThe action functions need not return anything. Whenever the shown screen50shall be recomputed after the function call, the component [10Xdynamic.changed[110X51of the browse table must be set to [9Xtrue[109X by the action functions.[133X5253[33X[0;0YAfter entering the first characters of an admissible input that consists of54more characters, the last line of the window with the browse table shows55these characters behind the prefix [21Xpartial input:[121X. One can delete the last56entered character of a partial input via the [12XDelete[112X and [12XBackspace[112X keys. It57is not possible to make these keys part of an admissible input. When a58partial input is given, only those user inputs have an effect that extend59the partial input to (a prefix of) an admissible input. For example, asking60for help by hitting the [12X?[112X key will in general not work if a partial input61had been entered before.[133X626364[1X5.2 [33X[0;0YModes in Browse Tables[133X[101X6566[33X[0;0YIn different situations, different inputs may be admissible for the same67browse table, and different functions may belong to the same input. For68example, the meaning of [21Xmoving down[121X can be different depending on whether a69cell is selected or not.[133X7071[33X[0;0YThe set of admissible user inputs and corresponding functions for a72particular situation is collected in a [13Xmode[113X of the browse table. (There73should be no danger to mix up this notion of mode with the [21Xvisual mode[121X74introduced in Section [14X1.1[114X.) A mode is represented by a record with the75components [10Xname[110X (a string used to associate the mode with the components of76[10Xheader[110X, [10XheaderLength[110X, [10Xfooter[110X, [10XfooterLength[110X, [10XClick[110X, and for the help screen),77[10Xflag[110X (a string that describes properties of the mode but that can be equal78for different modes), [10Xactions[110X (a list of records describing the navigation79steps that are admissible in the mode, see Section [14X5.1[114X), and [10XShowTables[110X (the80function used to eventually print the current window contents, the default81is [10XBrowseData.ShowTables[110X). Due to the requirement that each admissible user82input uniquely determines a corresponding function, no admissible user input83can be a prefix of another admissible input, for the same mode.[133X8485[33X[0;0YNavigation steps (see Section [14X5.1[114X) can change the current mode or keep the86mode. It is recommended that each mode has an action to leave this mode;87also an action to leave the browse table application is advisable.[133X8889[33X[0;0YIn a browse table, all available modes are stored in the component90[10Xwork.availableModes[110X, whose value is a list of mode records. The value of the91component [10Xdynamic.activeModes[110X is a list of mode records that is used as a92stack: The [13Xcurrent mode[113X is the last entry in this list, changing the current93mode is achieved by unbinding the last entry (so one returns to the mode94from which the current mode had been entered by adding it to the list), by95adding a new mode record (so one can later return to the current mode), or96by replacing the last entry by another mode record. As soon as the97[10Xdynamic.activeModes[110X list becomes empty, the browse table application is98left. (In this situation, if the browse table had been entered from the [5XGAP[105X99prompt then visual mode is left, and one returns to the [5XGAP[105X prompt.)[133X100101[33X[0;0YThe following modes are predefined by the [5XBrowse[105X package. Each of these102modes admits the user inputs [12X?[112X, [12XF1[112X, [12Xq[112X, [12XEsc[112X, [12XQ[112X, [12XF2[112X, [12XE[112X, and [12XM[112X that have been103mentioned in Section [14X5.1[114X.[133X104105[8Xbrowse[108X106[33X[0;6YThis mode admits scrolling of the browse table by a cell or by a107screen, searching for a string, selecting a row, a column, or an108entry, and expanding or collapsing all category rows.[133X109110[8Xhelp[108X111[33X[0;6YThis mode is entered by calling [10XBrowseData.ShowHelpTable[110X; it shows a112help window concerning the actions available in the mode from which113the [10Xhelp[110X mode was entered. The [10Xhelp[110X mode admits scrolling in the help114table by a cell or by a screen. See Section [14X5.4-4[114X for details.[133X115116[8Xselect_entry[108X117[33X[0;6YIn this mode, one table cell is regarded as selected; this cell is118highlighted using the attribute in the component [10Xwork.startSelect[110X as a119prefix of each attribute line, see the remark in Section [14X2.2-3[114X. The120mode admits moving the selection by one cell in the four directions,121searching for a string and for further occurrences of this string,122expanding or collapsing the current category row or all category rows,123and executing the [21Xclick[121X function of this mode, provided that the124component [10Xwork.Click.( "select_entry" )[110X of the browse table is bound.[133X125126[8Xselect_row[108X127[33X[0;6YThis is like the [10Xselect_entry[110X mode, except that a whole row of the128browse table is highlighted. Searching is restricted to the selected129row, and [21Xclick[121X refers to the function [10Xwork.Click.( "select_row" )[110X.[133X130131[8Xselect_row_and_entry[108X132[33X[0;6YThis is a combination of the [10Xselect_entry[110X mode and the [10Xselect_row[110X133mode.[133X134135[8Xselect_column[108X136[33X[0;6YThis is like the [10Xselect_row[110X mode, just a column is selected not a row.[133X137138[8Xselect_column_and_entry[108X139[33X[0;6YThis is like the [10Xselect_row_and_entry[110X mode, just a column is selected140not a row.[133X141142143[1X5.3 [33X[0;0YBrowse Applications[133X[101X144145[33X[0;0YThe data in a browse table together with the set of its available modes and146the stack of active modes forms a browse application. So the part of or all147functionality of the [5XBrowse[105X package can be available ([21Xstandard application[121X),148or additional functionality can be provided by extending available modes or149adding new modes.[133X150151[33X[0;0YWhen [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X) has been called with the browse table [3Xt[103X,152say, the following loop is executed.[133X153154[31X1[131X [33X[0;6YIf the list [3Xt[103X[10X.dynamic.activeModes[110X is empty then exit the browse table,155and if the component [3Xt[103X[10X.dynamic.Return[110X is bound then return its value.156Otherwise proceed with step 2.[133X157158[31X2[131X [33X[0;6YIf [3Xt[103X[10X.dynamic.changed[110X is [9Xtrue[109X then call the [10XShowTables[110X function of the159current mode; this causes a redraw of the window that shows the browse160table. Then go to step 3.[133X161162[31X3[131X [33X[0;6YGet one character of user input. If then the current user input string163is the name of an action of the current mode then call the164corresponding action function and go to step 1; if the current user165input string is just a prefix of the name of some actions of the166current mode then go to step 3; if the current user input string is167not a prefix of any name of an action of the current mode then discard168the last read character and go to step 3.[133X169170[33X[0;0YWhen one designs a new application, it may be not obvious whether some171functionality shall be implemented via one mode or via several modes. As a172rule of thumb, introducing a new mode is recommended when one needs a new173set of admissible actions in a given situation, and also if one wants to174allow the user to perform some actions and then to return to the previous175status.[133X176177178[1X5.4 [33X[0;0YPredefined Browse Functionalities[133X[101X179180[1X5.4-1 BrowseData[101X181182[29X[2XBrowseData[102X[32X global variable183184[33X[0;0YThis is the record that contains the global data used by the function185[2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X). The components are [10Xactions[110X, [10Xdefaults[110X, and186several capitalized names for which the values are functions.[133X187188[33X[0;0Y[10XBrowseData.actions[110X is a record containing the action records that are189provided by the package, see Section [14X5.1[114X. These actions are used in standard190applications of [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X). Of course there is no problem191with using actions that are not stored in [10XBrowseData.actions[110X.[133X192193[33X[0;0Y[10XBrowseData.defaults[110X is a record that contains the defaults for the browse194table used as the first argument of [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X). Important195components have been described above, see [2XBrowseData.IsBrowseTable[102X ([14X4.2-3[114X),196in the sense that these components provide default values of [10Xwork[110X components197in browse tables. Here is a list of further interesting components.[133X198199[33X[0;0YThe following components are provided in [10XBrowseData.defaults.work[110X.[133X200201[8X[10XwindowParameters[110X[8X[108X202[33X[0;6Yis a list of four nonnegative integers, denoting the arguments of203[10XNCurses.newwin[110X for the window in which the browse table shall be204shown. The default is [10X[ 0, 0, 0, 0 ][110X, i. e., the window for the browse205table is the full screen.[133X206207[8X[10Xminyx[110X[8X[108X208[33X[0;6Yis a list of length two, the entries must be either nonnegative209integers, denoting the minimal number of rows and columns that are210required by the browse table, or unary functions that return these211values when they are applied to the browse table; this is interesting212for applications that do not support scrolling, or for applications213that may have large row or column labels tables. The default is a list214with two functions, the return value of the first function is the sum215of the heights of the table header, the column labels table, the first216table row, and the table footer, and the return value of the second217function is the sum of widths of the row labels table and the width of218the first column. (If the header/footer is given by a function then219this part of the table is ignored in the [10Xminyx[110X default.) Note that the220conditions are checked only when [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X) is221called, not after later changes of the screen size in a running browse222table application.[133X223224[8X[10Xalign[110X[8X[108X225[33X[0;6Yis a substring of [10X"bclt"[110X, which describes the alignment of the browse226table in the window. The meaning and the default are the same as for227[2XBrowseData.IsBrowseTableCellData[102X ([14X4.2-1[114X). (Of course this is relevant228only if the table is smaller than the window.)[133X229230[8X[10XheaderLength[110X[8X[108X231[33X[0;6Ydescribes the lengths of the headers in the modes for which [10Xheader[110X232functions are provided. The value is a record whose component names233are names of modes and the corresponding components are nonnegative234integers. This component is ignored if the [10Xheader[110X component is unbound235or bound to a list, missing values are computed by calls to the236corresponding [10Xheader[110X function as soon as they are needed.[133X237238[8X[10XfooterLength[110X[8X[108X239[33X[0;6Ycorresponds to [10Xfooter[110X in the same way as [10XheaderLength[110X to [10Xheader[110X.[133X240241[8X[10XMain[110X[8X[108X242[33X[0;6Yif bound to a function then this function can be used to compute243missing values for the component [10Xmain[110X; this way one can avoid244computing/storing all [10Xmain[110X values at the same time. The access to the245entries of the main matrix is defined as follows: If246[10XmainFormatted[i][j][110X is bound then take it, if [10Xmain[i][j][110X is bound then247take it and compute the formatted version, if [10XMain[110X is a function then248call it with arguments the browse table, [10Xi[110X, and [10Xj[110X, and compute the249formatted version, otherwise compute the formatted version of250[10Xwork.emptyCell[110X. (For the condition whether entries in [10XmainFormatted[110X251can be bound, see below in the description of the component252[10XcacheEntries[110X.)[133X253254[8X[10XcacheEntries[110X[8X[108X255[33X[0;6Ydescribes whether formatted values of the entries in the matrices256given by the components [10Xcorner[110X, [10XlabelsCol[110X, [10XlabelsRow[110X, [10Xmain[110X, and of the257corresponding row and column separators shall be stored in the258components [10XcornerFormatted[110X, [10XlabelsColFormatted[110X, [10XlabelsRowFormatted[110X,259and [10XmainFormatted[110X. The value must be a Boolean, the default is [9Xfalse[109X;260it should be set to [9Xtrue[109X only if the tables are reasonably small.[133X261262[8X[10XcornerFormatted[110X[8X[108X263[33X[0;6Yis a list of lists of formatted entries corresponding to the [10Xcorner[110X264component. Each entry is either an attribute line or a list of265attribute lines (with the same number of displayed characters), the266values can be computed from the input format with267[10XBrowseData.FormattedEntry[110X. The entries are stored in this component268only if the component [10XcacheEntries[110X has the value [9Xtrue[109X. The default is269an empty list.[133X270271[8X[10XlabelsColFormatted[110X[8X[108X272[33X[0;6Ycorresponds to [10XlabelsCol[110X in the same way as [10XcornerFormatted[110X to [10Xcorner[110X.[133X273274[8X[10XlabelsRowFormatted[110X[8X[108X275[33X[0;6Ycorresponds to [10XlabelsRow[110X in the same way as [10XcornerFormatted[110X to [10Xcorner[110X.[133X276277[8X[10XmainFormatted[110X[8X[108X278[33X[0;6Ycorresponds to [10Xmain[110X in the same way as [10XcornerFormatted[110X to [10Xcorner[110X.[133X279280[8X[10Xm0[110X[8X[108X281[33X[0;6Yis the maximal number of rows in the column labels table. If this282value is not bound then it is computed from the components [10Xcorner[110X and283[10XlabelsCol[110X.[133X284285[8X[10Xn0[110X[8X[108X286[33X[0;6Yis the maximal number of columns in [10Xcorner[110X and [10XlabelsRow[110X.[133X287288[8X[10Xm[110X[8X[108X289[33X[0;6Yis the maximal number of rows in [10XlabelsRow[110X and [10Xmain[110X. This value [13Xmust[113X290be set in advance if the values of [10Xmain[110X are computed using a [10XMain[110X291function, and if the number of rows in [10Xmain[110X is larger than that in292[10XlabelsRow[110X.[133X293294[8X[10Xn[110X[8X[108X295[33X[0;6Yis the maximal number of columns in [10XlabelsCol[110X and [10Xmain[110X. This value296[13Xmust[113X be set in advance if the values of [10Xmain[110X are computed using a [10XMain[110X297function, and if the number of columns in [10Xmain[110X is larger than that in298[10XlabelsCol[110X.[133X299300[8X[10XheightLabelsCol[110X[8X[108X301[33X[0;6Yis a list of [22X2[122X [10Xm0[110X[22X+ 1[122X nonnegative integers, the entry at position [22Xi[122X is302the maximal height of the entries in the [22Xi[122X-th row of [10XcornerFormatted[110X303and [10XlabelsColFormatted[110X. Values that are not bound are computed on304demand from the table entries, with the function305[10XBrowseData.HeightLabelsCol[110X. (So if one knows the needed heights in306advance, it is advisable to set the values, in order to avoid that307formatted table entries are computed just for computing their size.)308The default is an empty list.[133X309310[8X[10XwidthLabelsRow[110X[8X[108X311[33X[0;6Yis the corresponding list of [22X2[122X [10Xn0[110X[22X+ 1[122X maximal widths of entries in312[10XcornerFormatted[110X and [10XlabelsRowFormatted[110X.[133X313314[8X[10XheightRow[110X[8X[108X315[33X[0;6Yis the corresponding list of [22X2[122X [10Xm[110X[22X+ 1[122X maximal heights of entries in316[10XlabelsRowFormatted[110X and [10XmainFormatted[110X.[133X317318[8X[10XwidthCol[110X[8X[108X319[33X[0;6Yis the corresponding list of [22X2[122X [10Xn[110X[22X+ 1[122X maximal widths of entries in320[10XlabelsColFormatted[110X and [10XmainFormatted[110X.[133X321322[8X[10XemptyCell[110X[8X[108X323[33X[0;6Yis a table cell data object to be used as the default for unbound324positions in the four matrices. The default is the empty list.[133X325326[8X[10XsepCategories[110X[8X[108X327[33X[0;6Yis an attribute line to be used repeatedly as a separator below328expanded category rows. The default is the string [10X"-"[110X.[133X329330[8X[10XstartCollapsedCategory[110X[8X[108X331[33X[0;6Yis a list of attribute lines to be used as prefixes of unhidden but332collapsed category rows. For category rows of level [22Xi[122X, the last bound333entry before the [22X(i+1)[122X-th position is used. The default is a list of334length one, the entry is the boldface variant of the string [10X"> "[110X, so335collapsed category rows on different levels are treated equally.[133X336337[8X[10XstartExpandedCategory[110X[8X[108X338[33X[0;6Yis a list of attribute lines to be used as prefixes of expanded339category rows, analogously to [10XstartCollapsedCategory[110X. The default is a340list of length one, the entry is the boldface variant of the string [10X"*341"[110X, so expanded category rows on different levels are treated equally.[133X342343[8X[10XstartSelect[110X[8X[108X344[33X[0;6Yis an attribute line to be used as a prefix of each attribute line345that belongs to a selected cell. The default is to switch the346attribute [10XNCurses.attrs.STANDOUT[110X on, see Section [14X2.1-7[114X.[133X347348[8X[10XClick[110X[8X[108X349[33X[0;6Yis a record whose component names are names of available modes of the350browse table. The values are unary functions that take the browse351table as their argument. If the action [10XClick[110X is available in the352current mode and the corresponding input is entered then the function353in the relevant component of the [10XClick[110X record is called.[133X354355[8X[10XavailableModes[110X[8X[108X356[33X[0;6Yis a list whose entries are the mode records that can be used when one357navigates through the browse table, see Section [14X5.2[114X.[133X358359[8X[10XSpecialGrid[110X[8X[108X360[33X[0;6Yis a function that takes a browse table and a record as its arguments.361It is called by [10XBrowseData.ShowTables[110X after the current contents of362the window has been computed, and it is intended to draw an individual363grid into the table that fits better than anything that can be364specified in terms of row and column separators. (If other functions365than [10XBrowseData.ShowTables[110X are used in some modes of the browse table,366these functions must deal with this aspect themselves.) The default is367to do nothing.[133X368369[33X[0;0YThe following components are provided in [10XBrowseData.defaults.dynamic[110X.[133X370371[8X[10Xchanged[110X[8X[108X372[33X[0;6Yis a Boolean that must be set to [9Xtrue[109X by action functions whenever a373refresh of the window is necessary; it is automatically reset to [9Xfalse[109X374after the refresh.[133X375376[8X[10XindexRow[110X[8X[108X377[33X[0;6Yis a list of positive integers. The entry [22Xk[122X at position [22Xi[122X means that378the [22Xk[122X-th row in the [10XmainFormatted[110X table is shown as the [22Xi[122X-th row. Note379that depending on the current status of the browse table, the rows of380[10XmainFormatted[110X (and of [10Xmain[110X) may be permuted, or it may even happen381that a row in [10XmainFormatted[110X is shown several times, for example under382different category rows. It is assumed (as a [21Xsort convention[121X) that the383[13Xeven[113X positions in [10XindexRow[110X point to [13Xeven[113X numbers, and that the384subsequent [13Xodd[113X positions (corresponding to the following separators)385point to the subsequent [13Xodd[113X numbers. The default value is the list [22X[3861, 2, ..., m ][122X, where [22Xm[122X is the number of rows in [10XmainFormatted[110X387(including the separator rows, so [22Xm[122X is always odd).[133X388389[8X[10XindexCol[110X[8X[108X390[33X[0;6Yis the analogous list of positive integers that refers to columns.[133X391392[8X[10Xtopleft[110X[8X[108X393[33X[0;6Yis a list of four positive integers denoting the current topleft394position of the main table. The value [22X[ i, j, k, l ][122X means that the395topleft entry is indexed by the [22Xi[122X-th entry in [10XindexRow[110X, the [22Xj[122X-th entry396in [10XindexCol[110X, and the [22Xk[122X-th row and [22Xl[122X-th column inside the corresponding397cell. The default is [22X[ 1, 1, 1, 1 ][122X.[133X398399[8X[10XisCollapsedRow[110X[8X[108X400[33X[0;6Yis a list of Booleans, of the same length as the [10XindexRow[110X value. If401the entry at position [22Xi[122X is [9Xtrue[109X then the [22Xi[122X-th row is currently not402shown because it belongs to a collapsed category row. It is assumed403(as a [21Xhide convention[121X) that the value at any even position equals the404value at the subsequent odd position. The default is that all entries405are [9Xfalse[109X.[133X406407[8X[10XisCollapsedCol[110X[8X[108X408[33X[0;6Yis the corresponding list for [10XindexCol[110X.[133X409410[8X[10XisRejectedRow[110X[8X[108X411[33X[0;6Yis a list of Booleans. If the entry at position [22Xi[122X is [9Xtrue[109X then the412[22Xi[122X-th row is currently not shown because it does not match the current413filtering of the table. Defaults, length, and hide convention are as414for [10XisCollapsedRow[110X.[133X415416[8X[10XisRejectedCol[110X[8X[108X417[33X[0;6Yis the corresponding list for [10XindexCol[110X.[133X418419[8X[10XisRejectedLabelsRow[110X[8X[108X420[33X[0;6Yis a list of Booleans. If the entry at position [22Xi[122X is [9Xtrue[109X then the421[22Xi[122X-th column of row labels is currently not shown.[133X422423[8X[10XisRejectedLabelsCol[110X[8X[108X424[33X[0;6Yis the corresponding list for the column labels.[133X425426[8X[10XactiveModes[110X[8X[108X427[33X[0;6Yis a list of mode records that are contained in the [10XavailableModes[110X428list of the [10Xwork[110X component of the browse table. The current mode is429the last entry in this list. The default depends on the application,430[10XBrowseData.defaults[110X prescribes the list containing only the mode with431[10Xname[110X component [10X"browse"[110X.[133X432433[8X[10XselectedEntry[110X[8X[108X434[33X[0;6Yis a list [22X[ i, j ][122X. If [22Xi = j = 0[122X then no table cell is selected,435otherwise [22Xi[122X and [22Xj[122X are the row and column index of the selected cell.436(Note that [22Xi[122X and [22Xj[122X are always even.) The default is [22X[ 0, 0 ][122X.[133X437438[8X[10XselectedCategory[110X[8X[108X439[33X[0;6Yis a list [22X[ i, l ][122X. If [22Xi = l = 0[122X then no category row is selected,440otherwise [22Xi[122X and [22Xl[122X are the row index and the level of the selected441category row. (Note that [22Xi[122X is always even.) The default is [22X[ 0, 0 ][122X.[133X442443[8X[10XsearchString[110X[8X[108X444[33X[0;6Yis the last string for which the user has searched in the table. The445default is the empty string.[133X446447[8X[10XsearchParameters[110X[8X[108X448[33X[0;6Yis a list of parameters that are modified by the function449[10XBrowseData.SearchStringWithStartParameters[110X. If one sets these450parameters in a search then these values hold also for subsequent451searches. So it may make sense to set the parameters to personally452preferred ones.[133X453454[8X[10XsortFunctionForColumnsDefault[110X[8X[108X455[33X[0;6Yis a function with two arguments used to compare two entries in the456same column of the main table (or two category row values). The457default is the operation [10X\<[110X. (Note that this default may be not458meaningful if some of the rows or columns contain strings representing459numbers.)[133X460461[8X[10XsortFunctionForRowsDefault[110X[8X[108X462[33X[0;6Yis the analogous function for comparing two entries in the same row of463the main table.[133X464465[8X[10XsortFunctionsForRows[110X[8X[108X466[33X[0;6Yis a list of comparison functions, if the [22Xi[122X-th entry is bound then it467replaces the [10XsortFunctionForRowsDefault[110X value when the table is sorted468w.r.t. the [22Xi[122X-th row.[133X469470[8X[10XsortFunctionsForColumns[110X[8X[108X471[33X[0;6Yis the analogous list of functions for the case that the table is472sorted w.r.t. columns.[133X473474[8X[10XsortParametersForRowsDefault[110X[8X[108X475[33X[0;6Yis a list of parameters for sorting the main table w.r.t. entries in476given rows, e. g., whether one wants to sort ascending or descending.[133X477478[8X[10XsortParametersForColumnsDefault[110X[8X[108X479[33X[0;6Yis the analogous list of parameters for sorting w.r.t. given columns.480In addition to the parameters for rows, also parameters concerning481category rows are available, e. g., whether the data columns that are482transformed into category rows shall be hidden afterwards or not.[133X483484[8X[10XsortParametersForRows[110X[8X[108X485[33X[0;6Yis a list that contains ar position [22Xi[122X, if bound, a list of parameters486that shall replace those in [10XsortParametersForRowsDefault[110X when the487table is sorted w.r.t. the [22Xi[122X-th row.[133X488489[8X[10XsortParametersForColumns[110X[8X[108X490[33X[0;6Yis the analogous list of parameters lists for sorting w.r.t. columns.[133X491492[8X[10Xcategories[110X[8X[108X493[33X[0;6Ydescribes the current category rows. The value is a list [22X[ l_1, l_2,494l_3 ][122X where [22Xl_1[122X is a [13Xsorted[113X list [22X[ i_1, i_2, ..., i_k ][122X of positive495integers, [22Xl_2[122X is a list of length [22Xk[122X where the [22Xj[122X-th entry is a record496with the components [10Xpos[110X (with value [22Xi_j[122X), [10Xlevel[110X (the level of the497category row), [10Xvalue[110X (an attribute line to be shown), [10Xseparator[110X (the498separator below this category row is a repetition of this string),499[10XisUnderCollapsedCategory[110X ([9Xtrue[109X if the category row is hidden because a500category row of an outer level is collapsed; note that in the [9Xfalse[109X501case, the category row itself can be collapsed), [10XisRejectedCategory[110X502([9Xtrue[109X if the category row is hidden because none of th edata rows503below this category match the current filtering of the table); the504list [22Xl_3[122X contains the levels for which the category rows shall include505the numbers of data rows under these category rows. The default value506is [10X[ [], [], [] ][110X. (Note that this [21Xhide convention[121X makes sense mainly507if together with a hidden category row, also the category rows on508higher levels and the corresponding data rows are hidden –but this509property is [13Xnot[113X checked.) Category rows are computed with the510[10XCategoryValues[110X function in the [10Xwork[110X component of the browse table.[133X511512[8X[10Xlog[110X[8X[108X513[33X[0;6Ydescribes the session log which is currently written. The value is a514list of positive integers, representing the user inputs in the current515session. When [5XGAP[105X returns from a call to [2XNCurses.BrowseGeneric[102X516([14X4.3-1[114X), one can access the log list of the user interactions in the517browse table as the value of its component [10Xdynamic.log[110X.[133X518519[33X[0;6YIf [10XBrowseData.logStore[110X had been set to [9Xtrue[109X before520[2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X) had been called then the list can also521be accessed as the value of [10XBrowseData.log[110X. If [10XBrowseData.logStore[110X is522unbound or has a value different from [9Xtrue[109X then [10XBrowseData.log[110X is not523written. (This can be interesting in the case of browse table524applications where the user does not get access to the browse table525itself.)[133X526527[8X[10Xreplay[110X[8X[108X528[33X[0;6Ydescribes the non-interactive input for the current browse table. The529value is a record with the components [10Xlogs[110X (a dense list of records,530the default is an empty list) and [10Xpointer[110X (a positive integer, the531default is [22X1[122X). If [10Xpointer[110X is a position in [10Xlogs[110X then currently the532[10Xpointer[110X-th record is processed, otherwise the browse table has533exhausted its non-interactive part, and requires interactive input.534The records in [10Xlog[110X have the components [10Xsteps[110X (a list of user inputs,535the default is an empty list), [10Xposition[110X (a positive integer denoting536the current position in the [10Xsteps[110X list if the log is currently537processed, the default is [22X1[122X), [10XreplayInterval[110X (the timeout between two538steps in milliseconds if the log is processed, the default is [22X0[122X), and539[10Xquiet[110X (a Boolean, [9Xtrue[109X if the steps shall not be shown on the screen540until the end of the log is reached, the default is [9Xfalse[109X).[133X541542[1X5.4-2 BrowseData.SetReplay[101X543544[29X[2XBrowseData.SetReplay[102X( [3Xdata[103X ) [32X function545546[33X[0;0YThis function sets and resets the value of547[10XBrowseData.defaults.dynamic.replay[110X.[133X548549[33X[0;0YWhen [2XBrowseData.SetReplay[102X is called with a list [3Xdata[103X as its argument then550the entries are assumed to describe user inputs for a browse table for which551[2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X) will be called afterwards, such that replay of552the inputs runs. (Valid input lists can be obtained from the component553[10Xdynamic.log[110X of the browse table in question.)[133X554555[33X[0;0YWhen [2XBrowseData.SetReplay[102X is called with the only argument [9Xfalse[109X, the556component is unbound (so replay is disabled, and thus calls to557[2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X) will require interactive user input).[133X558559[33X[0;0YThe replay feature should be used by initially setting the input list, then560running the replay (perhaps several times), and finally unbinding the561inputs, such that subsequent uses of other browse tables do not erroneously562expect their input in [10XBrowseData.defaults.dynamic.replay[110X.[133X563564[33X[0;0YNote that the value of [10XBrowseData.defaults.dynamic.replay[110X is used in a call565to [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X) only if the browse table in question does566not have a component [10Xdynamic.replay[110X before the call.[133X567568[1X5.4-3 BrowseData.AlertWithReplay[101X569570[29X[2XBrowseData.AlertWithReplay[102X( [3Xt[103X, [3Xmessages[103X[, [3Xattrs[103X] ) [32X function571[6XReturns:[106X [33X[0;10Yan integer representing a (simulated) user input.[133X572573[33X[0;0YThe function [2XBrowseData.AlertWithReplay[102X is a variant of [2XNCurses.Alert[102X574([14X3.1-1[114X) that is adapted for the replay feature of the browse table [3Xt[103X, see575Section [14X4.1[114X. The arguments [3Xmessages[103X and [3Xattrs[103X are the same as the576corresponding arguments of [2XNCurses.Alert[102X ([14X3.1-1[114X), the argument [10Xtimeout[110X of577[2XNCurses.Alert[102X ([14X3.1-1[114X) is taken from the browse table [3Xt[103X, as follows. If578[10XBrowseData.IsDoneReplay[110X returns [9Xtrue[109X for [10Xt[110X then [10Xtimeout[110X is zero, so a user579input is requested for closing the alert box; otherwise the requested input580character is fetched from [10Xt.dynamic.replay[110X.[133X581582[33X[0;0YIf [10Xtimeout[110X is zero and mouse events are enabled (see [2XNCurses.UseMouse[102X583([14X2.2-10[114X)) then the box can be moved inside the window via mouse events.[133X584585[33X[0;0YNo alert box is shown if [10XBrowseData.IsQuietSession[110X returns [9Xtrue[109X when called586with [3Xt[103X[10X.dynamic.replay[110X, otherwise the alert box is closed after the time (in587milliseconds) that is given by the [10XreplayInterval[110X value of the current entry588in [3Xt[103X[10X.dynamic.replay.logs[110X.[133X589590[33X[0;0YThe function returns either the return value of the call to [2XNCurses.Alert[102X591([14X3.1-1[114X) (in the interactive case) or the value that was fetched from the592current replay record (in the replay case).[133X593594[1X5.4-4 BrowseData.actions.ShowHelp[101X595596[29X[2XBrowseData.actions.ShowHelp[102X[32X global variable597598[33X[0;0YThere are two predefined ways for showing an overview of the admissible599inputs and their meaning in the current mode of a browse table. The function600[10XBrowseData.ShowHelpTable[110X displays this overview in a browse table (using the601[10Xhelp[110X mode), and [10XBrowseData.ShowHelpPager[110X uses [10XNCurses.Pager[110X.[133X602603[33X[0;0YTechnically, the only difference between these two functions is that604[10XBrowseData.ShowHelpTable[110X supports the replay feature of605[2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X), whereas [10XBrowseData.ShowHelpPager[110X simply does606not call the pager in replay situations.[133X607608[33X[0;0YThe action record [10XBrowseData.actions.ShowHelp[110X is associated with the user609inputs [12X?[112X or [12XF1[112X in standard [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X) applications, and610it is recommended to do the same in other [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X)611applications. This action calls the function stored in the component612[10Xwork.ShowHelp[110X of the browse table, the default (i. e., the value of613[10XBrowseData.defaults.work.ShowHelp[110X) is [10XBrowseData.ShowHelpTable[110X.[133X614615[4X[32X Example [32X[104X616[4X[25Xgap>[125X [27Xxpl1.work.ShowHelp:= BrowseData.ShowHelpPager;;[127X[104X617[4X[25Xgap>[125X [27XBrowseData.SetReplay( "?Q" );[127X[104X618[4X[25Xgap>[125X [27XUnbind( xpl1.dynamic );[127X[104X619[4X[25Xgap>[125X [27XNCurses.BrowseGeneric( xpl1 );[127X[104X620[4X[25Xgap>[125X [27Xxpl1.work.ShowHelp:= BrowseData.ShowHelpTable;;[127X[104X621[4X[25Xgap>[125X [27XBrowseData.SetReplay( "?dQQ" );[127X[104X622[4X[25Xgap>[125X [27XUnbind( xpl1.dynamic );[127X[104X623[4X[25Xgap>[125X [27XNCurses.BrowseGeneric( xpl1 );[127X[104X624[4X[25Xgap>[125X [27XBrowseData.SetReplay( false );[127X[104X625[4X[25Xgap>[125X [27XUnbind( xpl1.dynamic );[127X[104X626[4X[32X[104X627628[1X5.4-5 BrowseData.actions.SaveWindow[101X629630[29X[2XBrowseData.actions.SaveWindow[102X[32X global variable631632[33X[0;0YThe function [10XBrowseData.actions.SaveWindow.action[110X asks the user to enter the633name of a global [5XGAP[105X variable, using [2XNCurses.GetLineFromUser[102X ([14X3.1-3[114X). If634this variable name is valid and if no value is bound to this variable yet635then the current contents of the window of the browse table that is given as636the argument is saved in this variable, using [2XNCurses.SaveWin[102X ([14X2.2-11[114X).[133X637638[1X5.4-6 BrowseData.actions.QuitMode[101X639640[29X[2XBrowseData.actions.QuitMode[102X[32X global variable641[29X[2XBrowseData.actions.QuitTable[102X[32X global variable642643[33X[0;0YThe function [10XBrowseData.actions.QuitMode.action[110X unbinds the current mode in644the browse table that is given as its argument (see Section [14X5.2[114X), so the645browse table returns to the mode from which this mode had been called. If646the current mode is the only one, first the user is asked for confirmation647whether she really wants to quit the table; only if the [12Xy[112X key is hit, the648last mode is unbound.[133X649650[33X[0;0YThe function [10XBrowseData.actions.QuitTable.action[110X unbinds all modes in the651browse table that is given as its argument, without asking for confirmation;652the effect is to exit the browse application (see Section [14X5.3[114X).[133X653654[1X5.4-7 BrowseData.actions.Error[101X655656[29X[2XBrowseData.actions.Error[102X[32X global variable657658[33X[0;0YAfter [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X) has been called, interrupting by hitting659the [12XCtrl-C[112X keys is not possible. It is recommended to provide the action660[2XBrowseData.actions.Error[102X for each mode of a [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X)661application, which enters a break loop and admits returning to the662application. The recommended user input for this action is the [12XE[112X key.[133X663664665666