ComboBoxAddRow(comboName As String, item As String, optional rowTag As String)

 

Appends item in a new row to the end of the list of ComboBox comboName.

 

  

Parameters:

 

Name

Type

Description

comboName

String

ScreenFieldName of the control.

Ctrl+Click onto a ComboBox to retrieve its comboName

(= ScreenFieldName)

item

String

Text contents to be appended to the end of the ComboBox list.

rowTag

String

Hidden text to be added to the new row of the ComboBox list.

This text can be retrieved with the ComboBoxGetRowTag function.

The rowTag parameter is optional.

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

 

Hint: You can find references to XojoScripts which make use of this function by sending the following SQL statement to the database:

Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%ComboBoxAddRow%'

 

Example XojoScript:

 

// On modul EVENTS we can use a list "imLB_evt_List3" to store

// pricecodes, prices and invoice text in English, German or French.

// Here we retrieve the entire contents of that list for the first

// selected event record on the ADDRESS WITH EVENTS registration window

 

// Retrieve contents of pricecode list of selected event

Dim priceCodes As String = GetText("imLB_evt_List3",LinkList_GetID("evt"))

If priceCodes = "" Then Return

 

// Retrieve the language code of selected address

Dim lang As String

lang = Trim(Uppercase(GetText("imCO_adr_Language", LinkList_GetID("adr"))))

 

// If language is not set on address, try to determine country

If Len(lang) = 0 Then

lang = Uppercase(GetText("imCO_adr_Country", LinkList_GetID("adr")))

If Len(lang) > 1 Then lang = Left(lang,1)

End If

 

// Set language to English if we get anything else than German or French

Select Case lang

Case "D", "E", "F"

Case "A"

lang = "D"

Else

lang = "E"

End

 

// Define variables

Dim i As Integer

Dim arrRows(-1) As String

Dim arrColumns(-1) As String

 

// Fill each row of PriceCodes listbox into Array

arrRows = Split(priceCodes,EndOfRecord)

 

// Define variables

Dim u As Integer = UBound(arrRows)

Dim Code,Price,Text As String

Dim rTag As String

 

// Clear Combobox from category codes

ComboBoxDeleteAllRows("imCO_lnk_p01_CodeCategory")

 

// Add a first empty entry to Combobox

'ComboBoxAddRow("imCO_lnk_p01_CodeCategory","")

 

// Loop through Array 'arrRows' 

// to retrieve codes, values and text

For i = 0 To u-1

 

Redim arrColumns(-1)

rTag = ""

 

// Now fill each field of row into variables

arrColumns = Split(arrRows(i),EndOfField)

Code  = arrColumns(0)

Price = arrColumns(1)

 

// Fill Text variable according to address language

If lang = "D" Then Text = arrColumns(2)

If lang = "E" Then Text = arrColumns(3)

If lang = "F" Then Text = arrColumns(4)

 

// Add Code to Combobox and attach Price and Invoicetext as a Rowtag

rTag = Price + EndOfField + Text

ComboBoxAddRow("imCO_lnk_p01_CodeCategory",Code,rTag)

 

Next // i = 0 To u-1