Name
Listview.Insert -- insert new entry
Synopsis
pos = moai.DoMethod(id, "Insert", pos, [icon1,] column1$, ...)
Function
Insert one new entry into the listview. If the listview has multiple columns, you need to pass individual entry data for all the columns in the listview.

The entry data consists of a text string and, if the column has the Listviewcolumn.Icon attribute set, an icon for each column. The icon has to be passed before the text string and it has to be an identifier of a Hollywood brush/icon which should be used as the icon for the entry. If Listviewcolumn.Icon isn't set, then you must omit the icon parameter and only pass text data for the listview entry. If you've set Listviewcolumn.Icon to True and you don't want to show an icon in this particular row and column, you can also pass the special value -1. In that case, RapaGUI won't show an icon even though Listviewcolumn.Icon has been set to True. Please note that auto-generated IDs cannot be used. Please also read about RapaGUI's image cache to learn more about icon support in RapaGUI. See Image cache for details.

In case a column is showing a checkbox, you have to pass "On", "True", or "1" to select the checkbox and any other text to deselect the checkbox.

The insert position is specified in the pos argument. The new entry will be added in front of the entry specified by pos. This can be an absolute index position starting at 0 for the first entry or one of the following special values:

Top
Insert as first entry.

Active
Insert before the active entry. If there is no active entry, the entry will be inserted at the very top of the list.

Bottom
Insert as last entry.

If pos is bigger or equal to the number of entries in the listview, the entry will be inserted as the last entry.

If the listview has sortable columns, pos will be ignored and the entry will automatically be sorted into the listview, depending on which column currently has the sort focus. See Listview.SortColumn for details.

Listview.Insert returns the position of the newly inserted entry. This is especially useful when the listview has sortable columns because in that case, you can't easily compute where the entry will end up in the listview.

Note that on AmigaOS and compatibles icon support is only available with MUI 4.0 or better.

Inputs
id
id of the listview object
pos
insert position as absolute number or special value (see above)
icon1
optional: icon for the first column; this must only be passed if the column has the icon attribute set; note that this must be a numeric identifier and auto-generated IDs are not valid in this case
column1$
entry to insert into first column
...
more entries if listview has multiple columns
Results
pos
position of the newly inserted entry (starting from 0)

Show TOC