Child objects with UFT
Question ID: 107840
1
0

I have a Windows dialog on which lives a ToolbarWindow32 object. Visually speaking, there are buttons on the toolbar, but I haven’t been able to get any information about individual buttons. Is there a way to use ChildObjects to retrieve the names of the buttons? The code below is returning 0. Am I using ChildObjects correctly?

Set oDesc = Description.Create()
oDesc ("to_class").Value=".*"
Set children= Dialog("MYDIALOG").WinToolbar("ToolbarWindow32").ChildObjects (oDesc)
MsgBox children.count

Marked as spam
Posted by (Questions: 25, Answers: 12)
Asked on August 15, 2017 6:02 pm
875 views
Answers (2)
0
Private answer

I see the code is using Regular expression. Regular expressionis not set by default. Recommend trying following code first:

Set children= Dialog(''MYDIALOG'').WinToolbar(''ToolbarWindow32'').ChildObjects ()
MsgBox children.count

If you want to use regular expression

Set oDesc = Description.Create()
oDesc (''to_class'').Value=''.*''
oDesc (''PropName'').RegularExpression = False
Set children= Dialog(''MYDIALOG'').WinToolbar(''ToolbarWindow32'').ChildObjects (oDesc)
MsgBox children.count

I find most of the time dealing with dialogs I end up using device replay to invoke keyboard short cuts or tabs. If that does not work you can always use Insight.

If this answer works for you please mark it for others.

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on August 15, 2017 6:26 pm
0
Thanks! This helps.
( at August 15, 2017 6:29 pm)
0
Private answer

Thanks! This helps.

Marked as spam
Posted by (Questions: 25, Answers: 12)
Answered on August 15, 2017 6:29 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top