Forum Discussion

NisHera's avatar
NisHera
Valued Contributor
10 years ago

Fails searching object in intermediate parent

 

Have a window mapped up to  Aliases.MyApp.frmBrowser.MDIClient.CalenderMonth
In run time I have to get the field object
Aliases.MyApp.frmBrowser.MDIClient.CalenderMonth.VCLObject("pnlMain").VCLObject("pnlRecords").VCLObject("pnlPages").VCLObject("pgMainNoteBook").VCLObject("pgThresholds").VCLObject("grpThresholds").VCLObject("fldETPLowRate")
So I tryed following

var propArr = new Array('ObjectIdentifier','Visible');
var valuArr = new Array('pgThresholds','True' );
ThresholdPG =Aliases.MyApp.frmBrowser.MDIClient.CalenderMonth.FindEx(propArr,valuArr,10,true,2500);
myObject = ThresholdPG.FindChildEx('ObjectIdentifier','fldETPLowRate',12,true,2000);

eventhough ThresholdPG identified by TC, in run time always it failed to get myObject.
But if I drill down with objectspy to myObject it works after that.

 

I change my code as follows and start working smoothly....

CalenderMonth =Aliases.MyApp.frmBrowser.MDIClient.CalenderMonth;
myObject = CalenderMonth.FindChildEx('ObjectIdentifier','fldETPLowRate',12,true,2000);

Question is why dose it fails while searching with intermediate object but success with parent?

I'm using TC11.3

 

1 Reply

  • pyatakov's avatar
    pyatakov
    Occasional Contributor

     Hi! Just try use (if support) method  "RefreshMappingInfo" - 

     

    var propArr = new Array('ObjectIdentifier','Visible');
    var valuArr = new Array('pgThresholds','True' );
    var tmp_CalenderMonth = Aliases.MyApp.frmBrowser.MDIClient.CalenderMonth

    //\\from VBS
    If aqObject.IsSupported(tmp_CalenderMonth, "RefreshMappingInfo") Then
    tmp_CalenderMonth.RefreshMappingInfo
    End If
    //\\from VBS
    ThresholdPG =Aliases.MyApp.frmBrowser.MDIClient.CalenderMonth.FindEx(propArr,valuArr,10,true,2500); myObject = ThresholdPG.FindChildEx('ObjectIdentifier','fldETPLowRate',12,true,2000);