Combo Box Methods

The following methods belong to combo boxes.

AddComboEntry

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


The AddComboEntry method adds a string to the list of a combo box. The new item becomes the last one, if the list does not have the SORT flag set. In the case of a sorted list, the new item is inserted at the proper position.

Arguments:

The arguments are:

id

The ID of a combo box.

aString

The data to be inserted as a new line.

Example:

The following example adds the new line, Another item, to the list of combo box 103:

MyDialog~AddComboEntry(103, "Another item")

InsertComboEntry

>>-aBaseDialog~InsertComboEntry(--id--,--+-------+--,--string--)-><
                                         +-index-+


The InsertComboEntry method inserts a string into the list of a combo box.

Arguments:

The arguments are:

id

The ID of the combo box.

index

The index (line number) where you want to insert the new item. If this argument is omitted, the new item is inserted after the currently selected item.

string

The data string to be inserted.

Example:

This statement inserts The new third line after the second line into the list of combo box 103:

MyDialog~InsertComboEntry(103, 2, "The new third line")

DeleteComboEntry

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


The DeleteComboEntry method deletes a string from the combo box.

Arguments:

The arguments are:

id

The ID of the combo box.

index

The line number of the item to be deleted. Use the FindComboEntry method (see pageFindComboEntry) to retrieve the index of an item.

Example:

The following example shows a method that deletes the item that is passed to the method in the form of a text string from combo box 203:

      .
      .
      .
::method DeleteFromCombo
   use arg delStr
   idx = self~FindComboEntry(203, delStr)
   self~DeleteComboEntry(203, idx)

FindComboEntry

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


The FindComboEntry method returns the index corresponding to a given text string in the combo box.

Arguments:

The arguments are:

id

The ID of the combo box

aString

The string of which you search the index in the combo box.

Example:

See DeleteComboEntry for an example.

GetComboEntry

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


The GetComboEntry method returns the string at index of the combo box.

Arguments:

The arguments are:

id

The ID of the combo box

index

The index of the list entry to be retrieved

Example:

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

GetComboItems

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


The GetComboItems method returns the number of items in the combo box.

Arguments:

The only argument is:

id

The ID of the combo box

GetCurrentComboIndex

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


The GetCurrentComboIndex method returns the index of the currently selected item within the list. See GetComboLine for information on how to retrieve the selected combo box item.

Arguments:

The only argument is:

id

The ID of the combo box.

Example:

The following example displays the line number of the currently selected combo box item within entry line 240:

::class MyListDialog subclass UserDialog
     .
     .
     .
::method Init
   self~Init:super
   self~ConnectList(230, "ListSelected")
     .
     .
     .
::method ListSelected
   line = self~GetCurrentComboIndex(230)
   SetEntryLine(240, line)

Method ListSelected is called each time the selected item within the combo box changes.

SetCurrentComboIndex

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


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

Arguments:

The arguments are:

id

The ID of the combo box.

index

The index within the combo box.

ChangeComboEntry

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


The ChangeComboEntry method changes the value of a given entry in a combo box to a new string.

Arguments:

The arguments are:

id

The ID of the combo box

index

The index number of the item you want to replace. To retrieve the index, use the FindComboEntry or GetCurrentComboIndex method (see page FindComboEntry or GetCurrentComboIndex).

aString

The new text.

Example:

In the following example, method ChangeButtonPressed changes the currently selected line of combo box 230 to the value in entry line 250:

     .
     .
     .
::method ChangeButtonPressed
   idx = self~GetCurrentComboEntry(230)
   str = self~GetEntryLine(250)
   self~ChangeComboEntry(230, idx, str)

ComboAddDirectory

>>-aBaseDialog~ComboAddDirectory(--id--,--drvpath--,------------->

      +---------------+
      V               |
>--"----+-READWRITE-+-+--"--)-----------------------------------><
        +-READONLY--+
        +-HIDDEN----+
        +-SYSTEM----+
        +-DIRECTORY-+
        +-ARCHIVE---+


The ComboAddDirectory method adds all or selected file names in the given directory to the combo box.

Arguments:

The arguments are:

id

The ID of the combo box.

drvpath

The drive, path, and name pattern.

fileAttributes

Specify the file attributes that the files must have in order to be added:

READWRITE

Normal read/write files (same as none).

READONLY

Files that have the read-only bit.

HIDDEN

Files that have the hidden bit.

SYSTEM

Files that have the system bit.

DIRECTORY

Files that have the directory bit.

ARCHIVE

Files that have the archive bit.

Example:

The following example fills the combo box list with the names of all read/write files with extension .REX in the given directory:

MyDialog~ComboAddDirectory(203, drive":\"path"\*.rex", "READWRITE")

ComboDrop

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


The ComboDrop method deletes all items from the list of the given combo box.

Arguments:

The only argument is:

id

The ID of the combo box.