Wait for any of the screens in the provided list to be displayed.
String waitForScreen(String screenNames, int timeOut); String waitForScreen(String screenNames); int waitForScreen(int screenID); int waitForScreen(int screenID, int timeOut); int waitForScreen(int screenIDs[]); int waitForScreen(int screenIDs[], int timeOut, String exceptMessage); |
Arguments
HostScreen
Required. HostScreen object.
screenNames
Required. The fully qualified ScreenDef name for the screen. Can provide a comma-separated list of names.
TimeOut
Optional. Timeout in milliseconds. Defaults to the screen timeout set using the Admin Console.
screenID
Required if not the String form - an integer value originating from the active screen definition namespace's ScreenID enumeration as generated by the Mapper application.
screenIDs[]
Array of ScreenID integer values that provides a list of potential screens to recognize. When more than one screen can be displayed, and the ScreenID enumeration is being used instead of text screen names, use the array approach. See the example for a standard method that can be used to manage the conversion of the ScreenID integer enumeration to standard integer values.
exceptMessage
If a recognition exception is desired and the ScreenID enumeration is being used for screen recognition, use this parameter to provide the exception message string should none of the requested screens be displayed within the requested timeout.
Remarks
Returns the name of the active screen. Use the waitForScreen method to maintain synchronisation with the screen the host is on.
For .Net an SCRecogException exception is thrown if the returned screen name does not match an entry in the screenNames list.
Special values for screenName:
•"*" - wait for any screen that is NOT the default
•"*!" - wait for any screen that is NOT the default and is NOT the last screen recognized in a getScreenName, getScreenDef or the prior waitForScreen.
•"[error]" - return an error condition if none of the screens in the list is displayed. This value should always be last in the ScreenName list.
•"[error message]" - return an error condition if none of the screens in the list is displayed. The text from the message will be incorporated into the error message. The text "error" and the message must be separated by a space. This value should always be last in the ScreenName list and can be used as an alternative to "[error]".
The following waitForScreen method will wait for one of three recognised screens. If none of the screens appears it will display an error message:
string screenName=oScreen.waitForScreen("logon.OK,logon.Error,mainMenu,[error Not on a recognised startup screen]",30000);
The following waitForScreen method demonstrates how to wait for any known screen. A custom error message is returned if the screen is unknown:
string screenName=oScreen.waitForScreen("*,[error Not on a known screen]");
The next example shows how to detect a screen without having to use its fully-qualified name:
string screenName=oScreen.waitForScreen("Insure.MainMenu,Insure.Logon.*",40000);
Using with the ScreenID Enumeration
Here is an example method used to make the use of the ScreenID enumeration easy in this example, the namespace used in the Mapper Application generator was "insure"--
private insure.ScreenID NextScreen(string keys, insure.ScreenID screenID)
{
return NextScreen(keys,new ScreenID[]{screenID});
}
private insure.ScreenID NextScreen(string keys, insure.ScreenID[] screenIDs)
{
int[] ids=new int[screenIDs.Length];
int s;
for (s=0;s<screenIDs.Length;s++)
ids[s]=(int) screenIDs[s];
oScreen.putCommand(keys);
ScreenID found=(ScreenID) oScreen.waitForScreen(ids); // use default timeout
if (found==(ScreenID) 0)
{
StringBuilder sb=new StringBuilder();
sb.Append(screenIDs[0].ToString());
int i;
for (i=1;i<screenIDs.Length;i++)
{
sb.Append(", "+screenIDs[1].ToString());
}
throw new FSCProLib.SCRecogException(
"Expected Screen not found",
sb.ToString(),oScreen.getScreenName());
}
return found;
}
Requirements
Inventu Viewer+
See Also
SCRecogException | waitForCursor| waitForUpdate | cursorCol | cursorRow | screenColSize | screenRowSize
Applies To: HostScreen object
© 2022 Inventu Corporation