Search (Method).
Search the screen either forward or backwards for a text string.
Function Search(cursor As CursorPos, text As String, direction As SearchDirection) As Long
Parameters
No | Name | Type | Optional | Default | Description |
---|---|---|---|---|---|
1 | cursor | CursorPos | No | - | Position in the screen where search is to begin |
2 | text | String | No | - | Text to search for |
3 | direction | No | - | Direction of search | |
Return Code | Description | ||||
JGS_OK | The function was successful | ||||
JGS_NOTCONNECTED | Your application is not currently connected to any valid session | ||||
JGS_PARAMETERERROR | Missing or invalid parameter | ||||
JGS_POSITIONERROR | Invalid screen position | ||||
JGS_SYSERROR | The function failed due to a system error | ||||
JGS_NOFIELD | Search text was not found |
Remarks
If the return value is JGS_OK the CursorPos parameter will contain the position where the first character of the search text was found. The search will continue past the end or beginning of the screen until the whole screen was searched. This means that it is possible to find the search text before the starting position even if the search direction was FORWARD.
Sample Code
Dim myText as String
Dim myPos as CursorPos
Dim result as Long
myPos.row = 1
myPos.column = 1
myText = "Jolly Giant Software"
result = screen.Search(myPos, myText)
QWS3270 Automation copyright © Jolly Giant Software Inc. All rights reserved.