Edit

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

Definition:  Instantiates a selectable 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; and the column alignment. These specifiers are separated by vertical bar characters (|). The list should be terminated with a newline character (\n).

column_definition = Heading_Text | width * | alignment

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.

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

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 content of the list.

The optional_mode can specify behaviour of the list. This should be a number consisting of bit flags using the constants `fListMode_Selectable`, `fListMode_OnlyOne`, `fListMode_ContinuousItemHit`, `fListMode_DoubleclickAccept`, `fListMode_DoubleclickItemHit`, `fListMode_ToggleSelection`, `fListMode_Draggable`. (Deprecated: The mode can also be a comma-delimited string containing keywords: It can include the keyword "drag" for a reorderable list (equivalent to fListMode_Draggable), or "multiple" to allow selecting more than one line at a time (opposite to fListMode_OnlyOne) (these are mutually exclusive)).

Example usage: 

on Before:F_FORM(w)
    InsertListObject(w, "L_LIST2", "Head|99*\tHead2|99\tHead3|30|C\tHead4|70|R\n",
        "Blah\tBlah\t*\t0.00\nFoo\tBar\tn\t99.00\n" * 10, "multiple")
end

You get the entire table back as tab/newline-delimited text using GetListContents(listHandle) (useful if the user has reorderd the rows by dragging), or just the highlighted rows using GetListContents(listHandle, 1).

Availability:  available within MWScript handlers.

See Also:

GetListContents: Get a tab-delimited string with the contents of a simple list

SetListSelect: Highlight a row in a list

SetOptionsForEditList: Set options for the list