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[1X4 [33X[0;0YBrowsing Tables in [5XGAP[105X[101X[1X using [10Xncurses[110X[101X[1X βThe User Interface[133X[101X23[33X[0;0YAs stated in SectionΒ [14X1.1[114X, one aim of the [5XBrowse[105X package is to provide tools4for the quite usual task to show a two-dimensional array or certain rows and5columns of it on a character screen in a formatted way, to navigate in this6array via key strokes (and mouse events), and to search for strings, to sort7the array by row or column values etc.[133X89[33X[0;0YThe idea is that one starts with an array of data, the [13Xmain table[113X.10Optionally, labels for each row of the main table are given, which are also11arranged in an array (with perhaps several columns), the [13Xrow labels table[113X;12analogously, a [13Xcolumn labels table[113X of labels for the columns of the main13table may be given. The row labels are shown to the left of the main table,14the column labels are shown above the main table. The space above the row15labels and to the left of the column labels can be used for a fourth table,16the [13Xcorner table[113X, with information about the labels or about the main table.17Optionally, a [13Xheader[113X and a [13Xfooter[113X may be shown above and below these four18tables, respectively. Header and footer are not separated into columns. So19the shown window has the following structure.[133X2021ββββββββββββββββββββββββββββββββββ22β header β23ββββββββββ¬ββββββββββββββββββββββββ€24β β β25β corner β column labels β26β β β27ββββββββββΌββββββββββββββββββββββββ€28β β β29β β β30β row β main β31β labels β table β32β β β33β β β34β β β35ββββββββββ΄ββββββββββββββββββββββββ€36β footer β37ββββββββββββββββββββββββββββββββββ3839[33X[0;0YIf not the whole tables fit into the window then only subranges of rows and40columns of the main table are shown, together with the corresponding row and41column labels. Also in this case, the row heights and column widths are42computed w.r.t. the whole table not w.r.t. the shown rows and columns. This43means that the shown row labels are unchanged if the range of shown columns44is changed, the shown column labels are unchanged if the range of shown rows45is changed, and the whole corner table is always shown.[133X4647[33X[0;0YThe current chapter describes the user interface for [13Xstandard applications[113X48of this kind, i.Β e., those applications for which one just has to collect49the data to be shown in a record βwhich we call a [13Xbrowse table[113Xβ without need50for additional [5XGAP[105X programming.[133X5152[33X[0;0YSectionΒ [14X4.1[114X gives an overview of the features available in standard browse53table applications, and SectionΒ [14X4.2[114X describes the data structures used in54browse tables. Finally, SectionΒ [14X4.3[114X introduces the function55[2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X), which is the generic function for showing56browse table in visual mode.[133X5758[33X[0;0YFor technical details needed to extend these applications and to build other59applications, see ChapterΒ [14X5[114X.[133X6061[33X[0;0YExamples of browse table applications are shown in ChapterΒ [14X6[114X.[133X626364[1X4.1 [33X[0;0YFeatures Supported by the Function [10XNCurses.BrowseGeneric[110X[101X[1X[133X[101X6566[33X[0;0YStandard applications of the function [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X) have the67following functionality. Other applications may provide only a subset, or68add further functionality, see ChaptersΒ [14X5[114X andΒ [14X6[114X.[133X6970[8XScrolling:[108X71[33X[0;6YThe subranges of shown rows and columns of the main table can be72modified, such that the focus area is moved to the left, to the right,73up, or down; depending on the context, the focus is moved by one74character, by one table cell or a part of it, by the window75height/width (minus one character or minus one table cell). If mouse76events are enabled then cells can be selected also via mouse clicks.[133X7778[8XSelecting:[108X79[33X[0;6YA cell, row, or column of the main table can be selected; then it is80shown highlighted on the screen (by default using the attribute81[10XNCurses.attrs.STANDOUT[110X, see SectionΒ [14X2.1-7[114X). The selection can be moved82inside the main table to a neighboring cell, row, or column; this83causes also scrolling of the main table when the window borders are84reached.[133X8586[8XSearching:[108X87[33X[0;6YA search string is entered by the user, and the first matching cell88becomes selected; one can search further for the next matching cell.89Global search parameters define what matching means (case sensitive or90not, search for substrings or complete words) and what the first and91the next matching cells are (search in the whole table or just in the92selected row or column, search for whole words or prefixes or93suffixes, search forwards or backwards).[133X9495[8XSorting:[108X96[33X[0;6YIf a row or column is selected then the main table can be sorted97w.r.t. the entries in this row or column. Global sort parameters98describe for example whether one wants to sort ascending or99descending, or case sensitive or not.[133X100101[33X[0;6YIf a categorized table is sorted by a column then the category rows102are removed and the current sorting and filtering by rows is reset103before the table is sorted by the given column. If a table is sorted104by a column/row that is already sorted by a column/row then this105ordering is reset first.[133X106107[33X[0;6YSorting can be undone globally, i.Β e., one can return to the unsorted108table.[133X109110[8XSorting and Categorizing:[108X111[33X[0;6YIf a column is selected then the main table can be sorted w.r.t. the112entries in this column, and additionally these entries are turned into113[13Xcategory rows[113X, i.Β e., additional rows are added to the main table,114appearing immediately above the table rows with a fixed value in the115selected column, and showing this column value. (There should be no116danger to mix up this notion of categories with the one introduced117inΒ [14X'Reference: Categories'[114X.) The category rows can be [13Xcollapsed[113X (that118is, the table rows that belong to this category row are not shown) or119[13Xexpanded[113X (that is, the corresponding table rows are shown). Some of120the global search parameters affect the category rows, for example,121whether the category rows shall involve a counter showing the number122of corresponding data rows, or whether a row of the browse table123appears under different category rows.[133X124125[33X[0;6YSorting and categorizing can be undone globally, i.Β e., one can return126to the unsorted table without category rows.[133X127128[8XFiltering:[108X129[33X[0;6YThe browse table can be restricted to those rows or columns in which a130given search string occurs. (Also entries in collapsed rows can match;131they remain collapsed then.) As a consequence, the category rows are132restricted to those under which a matching row occurs. (It is133irrelevant whether the search string occurs in category rows.)[133X134135[33X[0;6YIf the search string does not occur at all then a message is printed,136and the table remains as it was before. If a browse table is137restricted then this fact is indicated by the message [21Xrestricted table[121X138in the lower right corner of the window.[133X139140[33X[0;6YWhen a column or row is selected then the search is restricted to the141entries in this column or row, respectively. Besides using a search,142one can also explicitly hide the selected row or column. Filtering in143an already restricted table restricts the shown rows or columns144further.[133X145146[33X[0;6YFiltering can be undone globally, i.Β e., one can return to the147unrestricted table.[133X148149[8XHelp:[108X150[33X[0;6YDepending on the application and on the situation, different sets of151user inputs may be available and different meanings of these inputs152are possible. An overview of the currently available inputs and their153meanings can be opened in each situation, by hitting the [12X?[112X key.[133X154155[8XRe-entering:[108X156[33X[0;6YWhen one has called [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X) with a browse table,157and returns from visual mode to the [5XGAP[105X prompt after some navigation158steps, calling [10XNCurses.BrowseGeneric[110X again with this table will enter159visual mode in the same situation where it was left. For example, the160cell in the top-left position will be the same as before, and if a161cell was selected before then this cell will be selected now. (One can162avoid this behavior using the optional second argument of163[10XNCurses.BrowseGeneric[110X.)[133X164165[8XLogging:[108X166[33X[0;6YThe integers corresponding to the user inputs in visual mode are167collected in a list that is stored in the component [10Xdynamic.log[110X of the168browse table. It can be used for repeating the inputs with the replay169feature. (For browse table applications that give the user no access170to the browse table itself, one can force the log to be assigned to171the component [10Xlog[110X of the global variable [10XBrowseData[110X, see172SectionΒ [14X5.4-1[114X.)[133X173174[8XReplay:[108X175[33X[0;6YInstead of interactively hitting keys in visual mode, one can176prescribe the user inputs to a browse table via a [21Xreplay record[121X; the177inputs are then processed with given time intervals. The easiest way178to create a meaningful replay record is via the function179[2XBrowseData.SetReplay[102X ([14X5.4-2[114X), with argument the [10Xdynamic.log[110X component180of the browse table in question that was stored in an interactive181session.[133X182183[33X[0;0YThe following features are not available in standard applications. They184require additional programming.[133X185186[8XClicking:[108X187[33X[0;6YOne possible action is to [21Xclick[121X a selected cell, row, or column, by188hitting the [12XEnter[112X key. It depends on the application what the effect189is. A typical situation is that a corresponding [5XGAP[105X object is added to190the list of return values of [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X). Again it191depends on the application what this [5XGAP[105X object is. In order to use192this feature, one has to provide a record whose components are [5XGAP[105X193functions, see SectionΒ [14X5.4-1[114X for details. If mouse events are enabled194(see [2XNCurses.UseMouse[102X ([14X2.2-10[114X)) then also mouse clicks can be used as195an alternative to hitting the [12XEnter[112X key.[133X196197[8XReturn Value:[108X198[33X[0;6YThe function [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X) may have an application199dependent return value. A typical situation is that a list of objects200corresponding to those cells is returned that were [21Xclicked[121X in visual201mode. In order to use this feature, one has to assign the desired202value to the component [10Xdynamic.Return[110X of the browse table.[133X203204205[1X4.2 [33X[0;0YData Structures used by [10XNCurses.BrowseGeneric[110X[101X[1X[133X[101X206207[1X4.2-1 BrowseData.IsBrowseTableCellData[101X208209[29X[2XBrowseData.IsBrowseTableCellData[102X( [3Xobj[103X ) [32X function210[6XReturns:[106X [33X[0;10Y[9Xtrue[109X if the argument is a list or a record in a supported format.[133X211212[33X[0;0YA [13Xtable cell data object[113X describes the input data for the contents of a cell213in a browse table. It is represented by either an attribute line214(seeΒ [2XNCurses.IsAttributeLine[102X ([14X2.2-3[114X)), for cells of height one, or a list of215attribute lines or a record with the components [10Xrows[110X, a list of attribute216lines, and optionally [10Xalign[110X, a substring of [10X"bclt"[110X, which describes the217alignment of the attribute lines in the table cell -- bottom, horizontally218centered, left, and top alignment; the default is right and vertically219centered alignment. (Note that the height of a table row and the width of a220table column can be larger than the height and width of an individual cell.)[133X221222[4X[32X Example [32X[104X223[4X[25Xgap>[125X [27XBrowseData.IsBrowseTableCellData( "abc" );[127X[104X224[4X[28Xtrue[128X[104X225[4X[25Xgap>[125X [27XBrowseData.IsBrowseTableCellData( [ "abc", "def" ] );[127X[104X226[4X[28Xtrue[128X[104X227[4X[25Xgap>[125X [27XBrowseData.IsBrowseTableCellData( rec( rows:= [ "ab", "cd" ],[127X[104X228[4X[25X>[125X [27X align:= "tl" ) );[127X[104X229[4X[28Xtrue[128X[104X230[4X[25Xgap>[125X [27XBrowseData.IsBrowseTableCellData( "" );[127X[104X231[4X[28Xtrue[128X[104X232[4X[25Xgap>[125X [27XBrowseData.IsBrowseTableCellData( [] );[127X[104X233[4X[28Xtrue[128X[104X234[4X[32X[104X235236[33X[0;0YThe [13Xempty string[113X is a table cell data object of height one and width zero237whereas the [13Xempty list[113X (which is not in [2XIsStringRep[102X ([14XReference:238IsStringRep[114X)) is a table cell data object of height zero and width zero.[133X239240[1X4.2-2 BrowseData.BlockEntry[101X241242[29X[2XBrowseData.BlockEntry[102X( [3Xtablecelldata[103X, [3Xheight[103X, [3Xwidth[103X ) [32X function243[6XReturns:[106X [33X[0;10Ya list of attribute lines.[133X244245[33X[0;0YFor a table cell data object [3Xtablecelldata[103X246(seeΒ [2XBrowseData.IsBrowseTableCellData[102X ([14X4.2-1[114X)) and two positive integers247[3Xheight[103X and [3Xwidth[103X, [10XBrowseData.BlockEntry[110X returns a list of [3Xheight[103X attribute248lines of displayed length [3Xwidth[103X each (seeΒ [2XNCurses.WidthAttributeLine[102X249([14X2.2-7[114X)), that represents the formatted version of [3Xtablecelldata[103X.[133X250251[33X[0;0YIf the rows of [3Xtablecelldata[103X have different numbers of displayed characters252then they are filled up to the desired numbers of rows and columns,253according to the alignment prescribed by [3Xtablecelldata[103X; the default254alignment is right and vertically centered.[133X255256[4X[32X Example [32X[104X257[4X[25Xgap>[125X [27XBrowseData.BlockEntry( "abc", 3, 5 );[127X[104X258[4X[28X[ " ", " abc", " " ][128X[104X259[4X[25Xgap>[125X [27XBrowseData.BlockEntry( rec( rows:= [ "ab", "cd" ],[127X[104X260[4X[25X>[125X [27X align:= "tl" ), 3, 5 );[127X[104X261[4X[28X[ "ab ", "cd ", " " ][128X[104X262[4X[32X[104X263264[1X4.2-3 BrowseData.IsBrowseTable[101X265266[29X[2XBrowseData.IsBrowseTable[102X( [3Xobj[103X ) [32X function267[6XReturns:[106X [33X[0;10Y[9Xtrue[109X if the argument record has the required components and is268consistent.[133X269270[33X[0;0YA [13Xbrowse table[113X is a [5XGAP[105X record that can be used as the first argument of the271function [2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X).[133X272273[33X[0;0YThe supported components of a browse table are [10Xwork[110X and [10Xdynamic[110X, their274values must be records: The components in [10Xwork[110X describe that part of the275data that are not likely to depend on user interactions, such as the table276entries and their heights and widths. The components in [10Xdynamic[110X describe277that part of the data that is intended to change with user interactions,278such as the currently shown top-left entry of the table, or the current279status w.r.t. sorting. For example, suppose you call [2XNCurses.BrowseGeneric[102X280([14X4.3-1[114X) twice with the same browse table; the second call enters the table281in the same status where it was left [13Xafter[113X the first call if the component282[10Xdynamic[110X is kept, whereas one has to reset (which usually simply means to283unbind) the component [10Xdynamic[110X if one wants to start in the same status as284[13Xbefore[113X the first call.[133X285286[33X[0;0YThe following components are the most important ones for standard browse287applications. All these components belong to the [10Xwork[110X record. For other288supported components (of [10Xwork[110X as well as of [10Xdynamic[110X) and for the meaning of289the term [21Xmode[121X, see SectionΒ [14X5.2[114X.[133X290291[8X[10Xmain[110X[8X[108X292[33X[0;6Yis the list of lists of table cell data objects that form the matrix293to be shown. There is no default for this component. (It is possible294to compute the entries of the main table on demand, see the295description of the component [10XMain[110X in SectionΒ [14X5.4-1[114X. In this situation,296the value of the component [10Xmain[110X can be an empty list.)[133X297298[8X[10Xheader[110X[8X[108X299[33X[0;6Ydescribes a header that shall be shown above the column labels. The300value is either a list of attribute lines ([21Xstatic header[121X) or a301function or a record whose component names are names of available302modes of the browse table ([21Xdynamic header[121X). In the function case, the303function must take the browse table as its only argument, and return a304list of attribute lines. In the record case, the values of the305components must be such functions. It is assumed that the number of306these lines depends at most on the mode. The default is an empty list,307i.Β e., there is no header.[133X308309[8X[10Xfooter[110X[8X[108X310[33X[0;6Ydescribes a footer that shall be shown below the table. The value is311analogous to that of [10Xfooter[110X. The default is an empty list, i.Β e.,312there is no footer.[133X313314[8X[10XlabelsRow[110X[8X[108X315[33X[0;6Yis a list of row label rows, each being a list of table cell data316objects. These rows are shown to the left of the main table. The317default is an empty list, i.Β e., there are no row labels.[133X318319[8X[10XlabelsCol[110X[8X[108X320[33X[0;6Yis a list of column information rows, each being a list of table cell321data objects. These rows are shown between the header and the main322table. The default is an empty list, i.Β e., there are no column323labels.[133X324325[8X[10Xcorner[110X[8X[108X326[33X[0;6Yis a list of lists of table cell data objects that are printed in the327upper left corner, i.Β e., to the left of the column label rows and328above the row label columns. The default is an empty list.[133X329330[8X[10XsepRow[110X[8X[108X331[33X[0;6Ydescribes the separators above and below rows of the main table and of332the row labels table. The value is either an attribute line or a (not333necessarily dense) list of attribute lines. In the former case,334repetitions of the attribute line are used as separators below each335row and above the first row of the table; in the latter case,336repetitions of the entry at the first position (if bound) are used337above the first row, and repetitions of the last bound entry before338the [22X(i+2)[122X-th position (if there is such an entry at all) are used339below the [22Xi[122X-th table row. The default is an empty string, which means340that there are no row separators.[133X341342[8X[10XsepCol[110X[8X[108X343[33X[0;6Ydescribes the separators in front of and behind columns of the main344table and of the column labels table. The format of the value is345analogous to that of the component [10XsepRow[110X; the default is the string [10X"346"[110X (whitespace of width one).[133X347348[8X[10XsepLabelsCol[110X[8X[108X349[33X[0;6Ydescribes the separators above and below rows of the column labels350table and of the corner table, analogously to [10XsepRow[110X. The default is351an empty string, which means that there are no column label352separators.[133X353354[8X[10XsepLabelsRow[110X[8X[108X355[33X[0;6Ydescribes the separators in front of and behind columns of the row356labels table and of the corner table, analogously to [10XsepCol[110X. The357default is an empty string.[133X358359[33X[0;0YWe give a few examples of standard applications.[133X360361[33X[0;0YThe first example defines a small browse table by prescribing only the362component [10Xwork.main[110X, so the defaults for row and column labels (no such363labels), and for separators are used. The table cells are given by plain364strings, so they have height one. Usually this table will fit on the screen.[133X365366[4X[32X Example [32X[104X367[4X[25Xgap>[125X [27Xm:= 10;; n:= 5;;[127X[104X368[4X[25Xgap>[125X [27Xxpl1:= rec( work:= rec([127X[104X369[4X[25X>[125X [27X main:= List( [ 1 .. m ], i -> List( [ 1 .. n ],[127X[104X370[4X[25X>[125X [27X j -> String( [ i, j ] ) ) ) ) );;[127X[104X371[4X[25Xgap>[125X [27XBrowseData.IsBrowseTable( xpl1 );[127X[104X372[4X[28Xtrue[128X[104X373[4X[32X[104X374375[33X[0;0YIn the second example, also row and column labels appear, and different376separators are used. The table cells have height three. Also this table will377usually fit on the screen.[133X378379[4X[32X Example [32X[104X380[4X[25Xgap>[125X [27Xm:= 6;; n:= 5;;[127X[104X381[4X[25Xgap>[125X [27Xxpl2:= rec( work:= rec([127X[104X382[4X[25X>[125X [27X main:= List( [ 1 .. m ], i -> List( [ 1 .. n ],[127X[104X383[4X[25X>[125X [27X j -> rec( rows:= List( [ -i*j, i*j*1000+j, i-j ], String ),[127X[104X384[4X[25X>[125X [27X align:= "c" ) ) ),[127X[104X385[4X[25X>[125X [27X labelsRow:= List( [ 1 .. m ], i -> [ String( i ) ] ),[127X[104X386[4X[25X>[125X [27X labelsCol:= [ List( [ 1 .. n ], String ) ],[127X[104X387[4X[25X>[125X [27X sepRow:= "-",[127X[104X388[4X[25X>[125X [27X sepCol:= "|",[127X[104X389[4X[25X>[125X [27X ) );;[127X[104X390[4X[25Xgap>[125X [27XBrowseData.IsBrowseTable( xpl2 );[127X[104X391[4X[28Xtrue[128X[104X392[4X[32X[104X393394[33X[0;0YThe third example additionally has a static header and a dynamic footer, and395the table cells involve attributes. This table will usually not fit on the396screen. Note that [10XNCurses.attrs.ColorPairs[110X is available only if the terminal397supports colors, which can be checked using [2XNCurses.attrs.has_colors[102X398([14X2.2-1[114X).[133X399400[4X[32X Example [32X[104X401[4X[25Xgap>[125X [27Xm:= 30;; n:= 25;;[127X[104X402[4X[25Xgap>[125X [27Xxpl3:= rec( work:= rec([127X[104X403[4X[25X>[125X [27X header:= [ " Example 3" ],[127X[104X404[4X[25X>[125X [27X labelsRow:= List( [ 1 .. 30 ], i -> [ String( i ) ] ),[127X[104X405[4X[25X>[125X [27X sepLabelsRow:= " % ",[127X[104X406[4X[25X>[125X [27X sepLabelsCol:= "=",[127X[104X407[4X[25X>[125X [27X sepRow:= "*",[127X[104X408[4X[25X>[125X [27X sepCol:= " |",[127X[104X409[4X[25X>[125X [27X footer:= t -> [ Concatenation( "top-left entry is: ",[127X[104X410[4X[25X>[125X [27X String( t.dynamic.topleft{ [ 1, 2] } ) ) ],[127X[104X411[4X[25X>[125X [27X ) );;[127X[104X412[4X[25Xgap>[125X [27Xif NCurses.attrs.has_colors then[127X[104X413[4X[25X>[125X [27X xpl3.work.main:= List( [ 1 .. m ], i -> List( [ 1 .. n ],[127X[104X414[4X[25X>[125X [27X j -> rec( rows:= [ String( -i*j ),[127X[104X415[4X[25X>[125X [27X [ NCurses.attrs.BOLD, true,[127X[104X416[4X[25X>[125X [27X NCurses.attrs.ColorPairs[56+1], true,[127X[104X417[4X[25X>[125X [27X String( i*j*1000+j ),[127X[104X418[4X[25X>[125X [27X NCurses.attrs.NORMAL, true ],[127X[104X419[4X[25X>[125X [27X String( i-j ) ],[127X[104X420[4X[25X>[125X [27X align:= "c" ) ) );[127X[104X421[4X[25X>[125X [27X xpl3.work.labelsCol:= [ List( [ 1 .. 30 ], i -> [[127X[104X422[4X[25X>[125X [27X NCurses.attrs.ColorPairs[ 56+4 ], true,[127X[104X423[4X[25X>[125X [27X String( i ),[127X[104X424[4X[25X>[125X [27X NCurses.attrs.NORMAL, true ] ) ];[127X[104X425[4X[25X>[125X [27Xelse[127X[104X426[4X[25X>[125X [27X xpl3.work.main:= List( [ 1 .. m ], i -> List( [ 1 .. n ],[127X[104X427[4X[25X>[125X [27X j -> rec( rows:= [ String( -i*j ),[127X[104X428[4X[25X>[125X [27X [ NCurses.attrs.BOLD, true,[127X[104X429[4X[25X>[125X [27X String( i*j*1000+j ),[127X[104X430[4X[25X>[125X [27X NCurses.attrs.NORMAL, true ],[127X[104X431[4X[25X>[125X [27X String( i-j ) ],[127X[104X432[4X[25X>[125X [27X align:= "c" ) ) );[127X[104X433[4X[25X>[125X [27X xpl3.work.labelsCol:= [ List( [ 1 .. 30 ], i -> [[127X[104X434[4X[25X>[125X [27X NCurses.attrs.BOLD, true,[127X[104X435[4X[25X>[125X [27X String( i ),[127X[104X436[4X[25X>[125X [27X NCurses.attrs.NORMAL, true ] ) ];[127X[104X437[4X[25X>[125X [27Xfi;[127X[104X438[4X[25Xgap>[125X [27XBrowseData.IsBrowseTable( xpl3 );[127X[104X439[4X[28Xtrue[128X[104X440[4X[32X[104X441442[33X[0;0YThe fourth example illustrates that highlighting may not work properly for443browse tables containing entries whose attributes are not set with explicit444Boolean values, see [2XNCurses.IsAttributeLine[102X ([14X2.2-3[114X). Call445[2XNCurses.BrowseGeneric[102X ([14X4.3-1[114X) with the browse table [10Xxpl4[110X, and select an446entry (or a column or a row): Only the middle row of each selected cell will447be highlighted, because only in this row, the color attribute is switched on448with an explicit [9Xtrue[109X.[133X449450[4X[32X Example [32X[104X451[4X[25Xgap>[125X [27Xxpl4:= rec([127X[104X452[4X[25X>[125X [27X defc:= NCurses.defaultColors,[127X[104X453[4X[25X>[125X [27X wd:= Maximum( List( ~.defc, Length ) ),[127X[104X454[4X[25X>[125X [27X ca:= NCurses.ColorAttr,[127X[104X455[4X[25X>[125X [27X work:= rec([127X[104X456[4X[25X>[125X [27X header:= [ "Examples of NCurses.ColorAttr" ],[127X[104X457[4X[25X>[125X [27X main:= List( ~.defc, i -> List( ~.defc,[127X[104X458[4X[25X>[125X [27X j -> [ [ ~.ca( i, j ), String( i, ~.wd ) ], # no true![127X[104X459[4X[25X>[125X [27X [ ~.ca( i, j ), true, String( "on", ~.wd ) ],[127X[104X460[4X[25X>[125X [27X [ ~.ca( i, j ), String( j, ~.wd ) ] ] ) ), # no true![127X[104X461[4X[25X>[125X [27X labelsRow:= List( ~.defc, i -> [ String( i ) ] ),[127X[104X462[4X[25X>[125X [27X labelsCol:= [ List( ~.defc, String ) ],[127X[104X463[4X[25X>[125X [27X sepRow:= "-",[127X[104X464[4X[25X>[125X [27X sepCol:= [ " |", "|" ],[127X[104X465[4X[25X>[125X [27X ) );;[127X[104X466[4X[25Xgap>[125X [27XBrowseData.IsBrowseTable( xpl4 );[127X[104X467[4X[28Xtrue[128X[104X468[4X[32X[104X469470471[1X4.3 [33X[0;0YThe Function [10XNCurses.BrowseGeneric[110X[101X[1X[133X[101X472473[1X4.3-1 NCurses.BrowseGeneric[101X474475[29X[2XNCurses.BrowseGeneric[102X( [3Xt[103X[, [3Xarec[103X] ) [32X function476[6XReturns:[106X [33X[0;10Yan application dependent value, or nothing.[133X477478[33X[0;0Y[2XNCurses.BrowseGeneric[102X is used to show the browse table [3Xt[103X479(seeΒ [2XBrowseData.IsBrowseTable[102X ([14X4.2-3[114X)) in a formatted way on a text screen,480and allows the user to navigate in this table.[133X481482[33X[0;0YThe optional argument [3Xarec[103X, if given, must be a record whose components [10Xwork[110X483and [10Xdynamic[110X, if bound, are used to provide defaults for missing values in484the corresponding components of [3Xt[103X. The default for [3Xarec[103X and for the485components not provided in [3Xarec[103X is [10XBrowseData.defaults[110X, seeΒ [2XBrowseData[102X486([14X5.4-1[114X), the function [10XBrowseData.SetDefaults[110X sets these default values.[133X487488[33X[0;0YAt least the component [10Xwork.main[110X must be bound in [3Xt[103X, with value a list of489list of table cell data objects, seeΒ [2XBrowseData.IsBrowseTableCellData[102X490([14X4.2-1[114X).[133X491492[33X[0;0YWhen the window or the screen is too small for the browse table, according493to its component [10Xwork.minyx[110X, the table will not be shown in visual mode, and494[9Xfail[109X is returned. (This holds also if there would be no return value of the495call in a large enough screen.) Thus one should check for [9Xfail[109X results of496programmatic calls of [2XNCurses.BrowseGeneric[102X, and one should better not admit497[9Xfail[109X as a regular return value.[133X498499[33X[0;0YMost likely, [2XNCurses.BrowseGeneric[102X will not be called on the command line,500but the browse table [3Xt[103X will be composed by a suitable function which then501calls [2XNCurses.BrowseGeneric[102X, see the examples in ChapterΒ [14X6[114X.[133X502503504505