The <table-control> class (which corresponds to the List View control in its "report" view in Microsoft documentation) allows you to display items in a table, with information divided into a number of column headings. This type of control is used when you need to display several pieces of information about each object, such as the name, size, modification date and owner of a file on disk. Typically, items can be sorted by any of the columns shown, in ascending or descending order, by clicking on the column header in question.
|
Because a table control displays more complex information than a list control, two init-keywords, headings: and generators: are used to create the contents of a table control, based on the control's items.
headings: This takes a sequence of strings that are used as the labels for each column in the control.
generators:This takes a sequence of functions. Each function is invoked on each item in the control to calculate the information displayed in the respective column.
Thus, the first element of the headings: sequence contains the heading for the first column in the control, and the first function in the generators: sequence is used to generate the contents of that column, and so on for each element in each sequence, as shown in Figure 7.15.
|
Note that the sequences passed to both of these init-keywords should contain the same number of elements, since there must be as many column headings as there are functions to generate their contents.
Like list boxes and list controls, table controls support the borders: and scroll-bars: init-keywords. Like list controls, the view: init-keyword and table-control-view slot can be used to manipulate the view used to display the information: choose between "table", #"small-icon", #"large-icon", and #"list". The widths: init-keyword can be used to determine the width of each column in a table control when it is created. This column takes a sequence of integers, each of which represents the width in pixels of its respective column in the control.