Combo_Item_Matching - ComboEntry
Returns the number of the combo item whose value matches sText
Type: Function
Return Data Type: Integer
Parameters
| Parameter | Type | Description |
|---|---|---|
| sText | String | The value to be searched for in the combo list |
Syntax
Function Combo_Item_Matching String sText Returns Integer
Call Example
Get Combo_Item_Matching sText to IntegerVariable
Description
The Combo_item_matching function returns the number of the combo item whose value matches sText. This is the message you will want to use to determine if an item in the internal list matches your form sText. This finds the item position in the internal list and not the Windows list. If the Windows list is sorted, these positions will be different.
This function checks to see if a value is in the combo-list
Function IsValueInList string sValue Returns Boolean
integer iPos
Get Combo_Item_Matching sValue to iPos // find the value in the list
Function_return (iPos>=0)
End_function
This function removes a value from the combo list and returns true if the item existed:
Function RemoveValue string sValue Returns Boolean
integer iPos
Get Combo_Item_Matching sValue to iPos // find the value in the list
If (iPos>=0) Begin
Send Combo_Delete_Item iPos
End
Function_return (iPos>=0)
End_function
Combo_Item_Matching can be used to match and find your current value with the value in your list. This sample assumes that you have an additional array of records that are added (and therefore ordered) the same as you data-list. This function returns the record for the current value in your combo form.
Function CurrentComboRecord returns integer
string sValue
integer iRecord iPos
Get Value to sValue // the value of the combo-form
Get Combo_Item_Matching sValue to iPos // find the value in the list
If (iPos=-1) Begin
Move -1 to iRecord // not found, no record...return -1
End
Else Begin
Get Value of oRecords iPos to iRecord // record id from the record array object
End
Function_return iRecord
End_function
See Also
Combo_add_item | Combo_Insert_Item | Combo_Delete_Item | Combo_Item_Count | Combo_value | Validate_Combo_Value | Add_Form_to_List
Return Value
If no combo item in the object has such a value, -1 is returned (0 is the number of the first combo item).