Forum Discussion
-Pv-
14 years agoOccasional Contributor
TC Enterprise 8.2 on Win7x64.
ChildCount is not always successful for me even after refresh on QWidget controls:
Object Browser:
Sys.Process("NAME").Form("License Wizard"):
ChildCount = 6
Children displayed:
Window("QWidget", "", 1)
Window("QWidget", "", 2)
MenuBar("System")
TitleBar(0)
Client("LicenceWizard")
Client(0)
In script
Sys.Process("NAME").Form("License Wizard").Refresh();
Log.Message("Searching " + Sys.Process("NAME").Form("License Wizard").ChildCount + " children...");
for (var i = 0; i < Sys.Process("NAME").Form("License Wizard").ChildCount; i++)
{
var MyItem = Sys.Process("NAME").Form("License Wizard").Child(i);
Log.Message("Searching Item: '" + MyItem.Name + "'");
}
Result:
Searching 4 children...
Searching Item: 'Client(0)'
Searching Item: 'Client("License Wizard")'
Searching Item: 'TitleBar(0)'
Searching Item: 'MenuBar("System")'
The control I want to click is in "Window("QWidget", "", 2)"
Note: the index may change to protect the innocent...
If I run this code multiple times, there is a random chance the window with the control I want will show up as one of the 4 detected children.
Very occasionally, 6 children will be reported and the control will be found.
-Pv-
ChildCount is not always successful for me even after refresh on QWidget controls:
Object Browser:
Sys.Process("NAME").Form("License Wizard"):
ChildCount = 6
Children displayed:
Window("QWidget", "", 1)
Window("QWidget", "", 2)
MenuBar("System")
TitleBar(0)
Client("LicenceWizard")
Client(0)
In script
Sys.Process("NAME").Form("License Wizard").Refresh();
Log.Message("Searching " + Sys.Process("NAME").Form("License Wizard").ChildCount + " children...");
for (var i = 0; i < Sys.Process("NAME").Form("License Wizard").ChildCount; i++)
{
var MyItem = Sys.Process("NAME").Form("License Wizard").Child(i);
Log.Message("Searching Item: '" + MyItem.Name + "'");
}
Result:
Searching 4 children...
Searching Item: 'Client(0)'
Searching Item: 'Client("License Wizard")'
Searching Item: 'TitleBar(0)'
Searching Item: 'MenuBar("System")'
The control I want to click is in "Window("QWidget", "", 2)"
Note: the index may change to protect the innocent...
If I run this code multiple times, there is a random chance the window with the control I want will show up as one of the 4 detected children.
Very occasionally, 6 children will be reported and the control will be found.
-Pv-
Related Content
- 12 months agomtsapa
- 7 months agomengbinhao