TcxDataControllerSearch.Locate(Integer,string,Boolean,Boolean) Method
Searches the first record whose field contains the specified text string.
Declaration
function Locate(AItemIndex: Integer; const ASubText: string; AIsAnywhere: Boolean = False; ASyncSelection: Boolean = True): Boolean; virtual;
Parameters
Name | Type |
---|---|
AItemIndex | Integer |
ASubText | string |
AIsAnywhere | Boolean |
ASyncSelection | Boolean |
Returns
Type |
---|
Boolean |
Remarks
Call this function to search a text string passed as the ASubText parameter in a field whose index is passed as the AItemIndex parameter. The Locate function searches the specified string starting from the focused record and returns True if the search operation is successful; otherwise, False. If the function does not find a match in the last record, the text search continues from the first record until it reaches the initial (that is, focused) record.
If the text search is successful, the Locate function moves focus to the record with the nearest found match and selects it, canceling the current selection. You can pass False as the ASyncSelection optional parameter to avoid any changes to the selection.
By default, the Locate function searches only a record with the string that matches ASubText starting from the first character. To search strings containing any matching character sequences, pass True as the optional AIsAnywhere parameter.
If the text search initiated by calling the Locate function is successful, you can call the LocateNext function to search the following or preceding match.