List Box Methods

The following methods deal with list boxes.

GetListWidth

>>-aBaseDialog~GetListWidth(--id--)----------------------------><


The GetListWidth method returns the scrollable width of a list box, in dialog units.

Arguments:

The only argument is:

id

The ID of the list box of which you want to know the scrollable width.

Return value:

The width of the scrollable area of the list box, in dialog units.

SetListWidth

>>-aBaseDialog~SetListWidth(--id--,--scrollwidth--)------------><


The SetListWidth method sets the scrollable width of a list box, in dialog units. If the scrollable width is greater than the width of the list box and the "HSCROLL" (WS_HSCROLL in the resource script) style is defined for the list box (see addListBox), a horizontal scroll bar is displayed.

Arguments:

The arguments are:

id

The ID of the list box for which you want to set the scrollable width.

scrollwidth

The width of the scrollable area of the list box, in dialog units.

Return value:

This method does not return a value.

SetListColumnWidth

>>-aBaseDialog~SetListColumnWidth(--id--,--columnwidth--)------><


The SetListColumnWidth method sets the width of all columns in a list box, in dialog units.

Arguments:

The arguments are:

id

The ID of the list box for which you want to set the column width.

columnwidth

The width of the columns in the list box, in dialog units.

Return value:

This method does not return a value.

AddListEntry

>>-aBaseDialog~AddListEntry(--id--,--aString--)----------------><


The AddListEntry method adds a string to the given list box. See also AddComboEntry. The line is added at the end (by default), or in sorted order if the list box was defined with the sorted flag.

Arguments:

The arguments are:

id

The ID of a list box.

aString

The data to be inserted as a new line.

InsertListEntry

>>-aBaseDialog~InsertListEntry(--id--,--+-------+--,--aString--)-><
                                        +-index-+


The InsertListEntry method inserts a string into the given list box. See also InsertComboEntry.

Arguments:

The arguments are:

id

The ID of the list box.

index

The index (line number starting with 1) of the item after which the new item is inserted. If this argument is omitted, the new item is inserted after the currently selected item.

aString

The text string to be inserted.

DeleteListEntry

>>-aBaseDialog~DeleteListEntry(--id--,--index--)---------------><


The DeleteListEntry method deletes an item from a list box. See also DeleteComboEntry.

Arguments:

The arguments are:

id

The ID of the list box.

index

The line number of the item to be deleted. Use FindListEntry to retrieve the index of an item. If this argument is omitted, the currently selected item is deleted.

FindListEntry

>>-aBaseDialog~FindListEntry(--id--,--aString--)---------------><


The FindListEntry method returns the index of the given string within the given list box. The first item has index 1, the second has index 2, and so forth. If the list box does not contain the string, 0 is returned.

Arguments:

The arguments are:

id

The ID of the list box.

aString

The item text you are looking for.

Example:

The following example shows a method that adds the contents of an entry line (214) to the list box (215) if no item with the same value is already contained in it:

      .
      .
      .
::method PutEntryInList
   str = self~GetEntryLine(214)
   if self~FindListEntry(215, str) = 0 then
      self~AddListEntry(215, str)

GetListEntry

>>-aBaseDialog~GetListEntry(--id--,--index--)------------------><


The GetListEntry method returns the string at index of the list.

Arguments:

The arguments are:

id

The ID of the list box.

index

The index of the list entry to be retrieved.

Example:

if dlg~GetListEntry(203,5)="JOHN"
then ...

GetListItems

>>-aBaseDialog~GetListItems(--id--)----------------------------><


The GetListItems method returns the number of items in the list box.

Arguments:

The only argument is:

id

The ID of the list box.

GetListItemHeight

>>-aBaseDialog~GetListItemHeight(--id--)-----------------------><


The GetListItemHeight method returns the height of the items in a list box, in dialog units.

Arguments:

The only argument is:

id

The ID of the list box of which you want to know the item height.

Return value:

The height of the list box items, in dialog units.

SetListItemHeight

>>-aBaseDialog~SetListItemHeight(--id--,--itemheight--)--------><


The SetListItemHeight method sets the height for all items in a list box, in dialog units. It determines the space between the individual list box items.

Arguments:

The arguments are:

id

The ID of the list box for which you want to set the item height.

itemheight

The height of the items in the list box, in dialog units.

Return value:

A number smaller than 0 if the height that you specify is not valid.

GetCurrentListIndex

>>-aBaseDialog~GetCurrentListIndex(--id--)---------------------><


The GetCurrentListIndex method returns the index of the currently selected list box item, or 0 if no item is selected. See GetListLine for information on how to retrieve the selected list box item.

Arguments:

The only argument is:

id

The ID of the list box.

SetCurrentListIndex

>>-aBaseDialog~SetCurrentListIndex(--id--+----------+--)-------><
                                         +-,--index-+


The SetCurrentListIndex selects the item with the given index in the list. If called without an index, all items in the list are deselected. See SetListLine for information on how to select a list box item using a data value.

Arguments:

The arguments are:

id

The ID of the list box.

index

The index within the list box.

ChangeListEntry

>>-aBaseDialog~ChangeListEntry(--id--,--+-------+--,--aString--)-><
                                        +-index-+


The ChangeListEntry method changes the contents of a line in a list box.

Arguments:

The arguments are:

id

The ID of the list box.

index

The index of the item that you want to replace. If this argument is omitted, the currently selected item is changed.

aString

The new text of the item.

SetListTabulators

                                          +-,---+
                                          V     |
>>-aBaseDialog~SetListTabulators(--id--,----tab-+--)-----------><


The SetListTabulators method sets the tabulators for a list box. Thus you can use items containing tab characters ("09"x), which is useful for formatting the list in more than one column.

Arguments:

The arguments are:

id

The ID of the list box.

tab

The positions of the tabs relative to the left edge of the list box.

Example:

The following example creates a four-column list and adds a tab-formatted row to the list. The tabulator positions are 10, 20, and 30.

MyDialog~SetListTabulators(102, 10, 20, 30)
MyDialog~AddListEntry(102, var1  "09"x
var2  "09"x  ,
                           var3  "09"x  var4)

ListAddDirectory

                                                        +---------------+
                                                        V               |
>>-aBaseDialog~ListAddDirectory(--id--,--drvPath--,--"----+-READWRITE-+-+--"--)-><
                                                          +-READONLY--+
                                                          +-HIDDEN----+
                                                          +-SYSTEM----+
                                                          +-DIRECTORY-+
                                                          +-ARCHIVE---+


The ListAddDirectory method adds all or selected file names of a given directory to the list box. See ComboAddDirectory for more information.

ListDrop

>>-aBaseDialog~ListDrop(--id--)-------------------------------><


The ListDrop method removes all items from the list box.

Arguments:

The only argument is:

id

The ID of the list box.