Edit

InsertEditListObject (windowHandle, itemID, column_definition, optional_initial_data, optional_mode)

Definition:  Instantiates an editable list object in a custom window (which has itself been instantiated with ModalWindow() or CreateWindow()). The custom window will already have a placeholder object for the list, but that will be blank until a list is actually instantiated. Use this function in the Before handler for your custom window to instantiate your list object. You must have inserted the list before you attempt to get or use a handle to the list object.

The itemID is the item number or identifier string for the placeholder item in the custom form.

The column definition is a tab-delimited list of column headings. Each column heading may optionally be followed by specifiers for the column width; the column alignment; and whether or not the column is read-only. These specifiers are separated by vertical bar characters (|). The list should be terminated with a newline character (\n).

column_definition = Heading_Text | width * | alignment | writeability

The * after the width is optional and denotes that the column will resize if the columns widths do not add up to the list width. Default is 80 and the first column is the resizable one by default.

Alignment can be one of 'L', 'C', 'R' for left, centre or right alignment. Default is left.

Writeability can be 'w' or 'r' for writeable or read-only. Writeable is the default, so only needs to be specified for read-only columns.

Examples: 

"My Heading" — a left aligned cell (by default, 80 points wide)

"My Heading|100" — 100 points wide column

"My Heading|80|R" — right-aligned column

"My Heading|30|C|r" — centred read-only column

"|||r" — column with blank heading, default width, default alignment and read-only

Note that the headings will define the specific messages that you will get for handlers such as ExitedCell. e.g. ExitedCell:F_FORM:L_LIST:My_Heading(...)

The optional_initial_data can be a tab- and newline-delimited table of data which should have the same number of columns as the column definition. This will be used to populate the initial content of the editable list. If it is omitted the list will be empty. You can add rows to the list later using AddListLine().

The optional_mode can specify behaviour of the list. Currently the only support mode is "autoadd" which adds a new row to the bottom of the list when the user presses return when on the last line. This mode is off by default.

Example usage:

on Before:F_FORM(w)
    InsertEditListObject(w, "L_LIST", "Head1\tHead2|99*\tHead3|30|C|r\tHead4|70|R\n",
            "FOO\tBar\tN\t123.45\nBAZ\t\t*\t99.00\n")
end

You can extract modified data using GetListField on each cell, or you get get the entire table back as tab/newline-delimited text using GetListContents(listHandle).

Availability:  available within MWScript handlers.