Item_Matching - DfBaseList
Searches a menu of items for a matching string value
Type: Property
Access: Read-Only
Data Type: Integer
Parameters: None
Parameters
| Parameter | Type | Description |
|---|---|---|
| sMatch | String | The match string |
| iItem | Integer | Search start and returned matching item |
Syntax
Property Integer Item_Matching
| Access Type | Syntax |
|---|---|
| Read Access: | Get Item_Matching to IntegerVariable |
Description
The Item_Matching message searches a menu of items for a matching string value. By default, the search is not case sensitive. You may make the search case sensitive by setting Search_Case to True.
The search begins at iItem and returns the item number of the first matching item. If the item was not found, then the message returns 1. The search string may include the ? and * wildcard characters. Literal asterisks (*) and question marks (?) may be found by preceding the characters with a tilde (~). You may add 1 to the returned iItem value to continue the search for the next occurrence. This message may not be used as a function in an expression since the return value is placed in the iItem parameter. This message is sent by the Key message each time the object needs to perform an incremental search.
Procedure Test
Integer iItem
Get Item_Matching "FIND_ME" iItem to bFound
If (iItem = -1) Begin
send Bell
End
Else Begin
Set Current_Item to iItem
End
End_Procedure // Test
Because the number of the item that matches is returned to the iItem parameter that is passed, iItem must be a variable (may not be a literal number). For example, to augment this message, the following technique should be used:
Function Item_Matching String sMatchValue Integer iFromItem Returns Integer
Integer iMatchItem
Boolean bFound
Move iFromItem To iMatchItem
Forward Get Item_Matching sMatchValue iMatchItem to bFound
:
Function_Return iMatchItem
End_Function
Augmenting Item_Matching will not work for menu-based classes that handle databases (data-entry objects (DEOs)). In order to invoke case insensitivity in DEO lists (dbList, dbGrid), you may either set DD_Capslock to True for the table or use a case-insensitive index.