Using Win32 Screen Elements During Runtime
You can use captured screen elements in your project. Below is an example of how to work with properties and functions of the Win32 Button screen element in Monitor during runtime (i. e. in Real-time Client).
To use a Win32 screen element during runtime:
1. | Run the project and select Monitor. For more information, see Running the Monitor. |
2. | Click the Screen Element tab and expand the object hierarchy. |
The full hierarchy of the captured Win32 screen element is displayed (including hidden captures).
3. | Select the relevant Win32 screen element in the tree on the left. |
The list of screen element properties is shown in the Properties tab on the right:
Monitor shows only functions of simple return types (Boolean, DateTime, Decimal, Number, Text). To view properties of other types (List type, Screen Element Rectangle type, and other business entities), you must bind them to business entities in the project.
You can change the value of the Enable and Visible properties of an element to True.
The values of other properties can be retrieved from the application.
4. | Click the Functions tab. |
The functions of the screen element are listed in the Available Functions drop-down list:
Monitor shows only functions of simple return types. Functions such as List of PO, PO, and CtrlPO are not shown. To use functions that are not shown, you need to define them in the Business Entities module in Real-Time Designer (see Examples of Using Complex Functions).
Available Functions
The following functions are available from the Available Functions drop-down list in Monitor:
Click: This function clicks on the physical object in the Win32 application. To run this function, select Click from the Available Functions drop-down list and click Invoke.
Bring to Front: This function moves the Win32 element to the top of the stacking order ( brings the element to the front). To run this function, select Bring to front from the Available Functions drop-down list and click Invoke.
Set Focus: This function gives focus to a screen element. To run this function, select Set Focus from the Available Functions drop-down list and click Invoke.
Do Accessible Default Action: This function performs the default action specified for Win32 elements in the application. To run this function, select Do Accessible Default Action from the Available Functions drop-down list and click Invoke.
Refresh: This function runs a process that validates the objects beginning from the top level in the objects hierarchy. The process destroys any object that no longer exist, and attempts to recognize new objects and their child objects down the hierarchy. To run this function, select Refresh from the Available Functions drop-down list and click Invoke.
Click On Point: This function allows you to select a specified point in a physical element. To run this function, select Click On Point from the Available Functions drop-down list. Then define the x and y parameters in the Parameters table and click Invoke.
Double Click On Point: This function allows you to double-cclick a specified point in a physical element. To run this function, select Double Click On Point in the Available Functions drop-down list. Then define the x and y parameters in the Parameters table and click Invoke.
Locate: This function allows you to locate the captured Win32 screen element in the Win32 application. To run this function, select Locate from the Available Functions drop-down list and click Invoke.
The element is indicated with a red frame in the Win32 application.
Emulate Keyboard: This function emulates entering text from the keyboard. To run this function, select Emulate Keyboard from the Available Functions drop-down list. Then specify the value of the Text parameter by defining the text that you want to emulate, and click Invoke to emulate entering text from the keyboard.
Emulate Mouse Click: This function emulates right-clicking the Win32 element. To run this function, select Emulate Mouse Click from the Available Functions drop-down list and click Invoke:
Examples of Using Complex Functions
The following complex functions are described herein:
Get Enumerator
Get Instance By Parent
Get Instances
Instances of the CtrlPO type are screen elements that are not process screen elements. Instances of the PO type are screen elements (i.e., CtrlPO + Process).
Complex functions of other Win32 screen elements can be created according to Examples 1. – 4. below.
Get Enumerator
The Get Enumerator function returns an enumerating physical object. The returned type is CtrlPO. You can use it with every screen element whose enumerator is an element (the process is excluded because it doesn’t have an enumerator). Also the top level window is usually excluded, because its enumerator is the process.
In Screen Elements tree below, the enumerator of the Win32 Button screen element type is #32770.
In the example below, a new function’s definition invokes the Get Enumerator function, locates the enumerator in the Win32 application, and returns the Windows Handle value of this enumerator. Because the Get Enumerator function returns an enumerator of the Win32 Form type, you can define the following by creating a new Business Entity Function of the Number type in the Business Entity tab in Real-Time Designer (see Defining a Business Entity Function):
Next, assign the created function to a Business Entity property of the Text type in order to retrieve the Text value, which the _Get Enumerator function (Ctrl PO) function returns in this example.
For this purpose, a new function (Get Enumerator - For Use) is created and assigned to the Business Entity property:
Place Get Enumerator - For Use function into a callout.
In runtime, invoke the function by clicking the function’s link.
The enumerator of the Win32 element is located and its Window Handle value is shown in the callout:
Get Instance By Parent
This function returns the first recognized physical object of a screen element, whose enumerator (parent) has the given Window Handle value (the input argument to this function is the enumerator’s Window Handle). The return type is PO. You can use it with every CtrlPO screen elements.
In the Screen Elements tree below, the enumerator of the Win32 Button screen element type is #32770.
In the example below, a new function definition invokes the Get Instance By Parent function and then returns the Window Handle value of the Win32 Button screen element, whose enumerator window handle is a input argument.
Knowing that the function returns an instance of the Win32 Button type, you can define the following by creating a new Business Entity Function of the Number type in the Business Entity tab in Real-Time Designer (see Defining a Business Entity Function on how to create a new function ):
Next, assign the created function to a Business Entity property of the Number type in order to retrieve the Window Handle value, that the _Get Instance By Parent (CtrlPO) function returns in our example.
For this purpose, create a new function (Get Instance By Parent - For use) and assign it to the Business Entity property:
Place the Get Instance By Parent - For use function into a callout.
In runtime, invoke the function by clicking the function’s link.
The Window Handle’s value of the Win32 Button’s instance is shown in the callout.
Get Instances
This function returns all recognized physical objects' instances of a screen element (can be a number of multi-instances). You can use this function with every screen element. The return type is List of PO.
In the example below, a new function definition invokes the Get Instances function and returns a list of Window Handles of all recognized instances of the captured Win32 Button (multi-instances).
Knowing that the function returns an instance of the Win32 Button type, you can define the following by creating a new Business Entity function of the List of Number type in the Business Entity tab in Real-Time Designer (see Defining a Business Entity Function on how to create a new function ):
Next, assign the created function to a Business Entity property of the Number type to retrieve the Window Handles value, that the _Get instances (List of PO) function returns in our example.
For this purpose, create an additional new function (Get Instances - For use) and assign it to the Business Entity property:
Now you can place the Get instances - For use function into a callout.
In runtime, you can invoke the function by clicking the function’s link.
The Window Handle values of the Win32 General’s instances is shown in the callout.