Forum Discussion
I would look into using "FindAllChildren" against the container of the tree itself to search for all items within the panel. This will find all that are visible on screen and not, just listing what's in the panel. This returns an array that you can just loop through from 0 to array length -1... and you can just loop through that as many times as you want.
Hello,
Sorry for late reply!!
I have already tried FindAllChildren, it didn't work for me. It was getting stuck at the end and couldn't go back to top unless I provide mousewheel(1) but with providing mousewheel(1) & mousewheel(-1) the script was just rotating up & down at same location.
So finally I have to ask for solution in community. If you need I can share my code too.
- tristaanogre6 years agoEsteemed Contributor
Yes, please... share your code.
- ChandanD6 years agoContributor
Code from my application
set CalConfigTab = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.PanetabitemCalculationConfiguration set BrakeCaseTab = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.BrakeCaseTab Function BrakeCalTypeCopy Dim Driver,Path Path = Project.Path CalConfigTab.Click BrakeCaseTab.Click set CalPanel = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.ContentpaneConfigurationTree.Grid.StackPanel set BtnExpand = CalPanel.FindChild(Array("WPFControlName", "WPFControlOrdinalNo"), Array("BtnExpandAll","1"),50) ToolT = BtnExpand.ToolTip log.Message ToolT if Not (ToolT="Collapse Items") then BtnExpand.Click set defBr = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.ContentpaneConfigurationTree.Grid.CalcTree ParamFoundBool=False PasteFoundBool=False set Driver = DDT.ExcelDriver(Path&"TestData\PrjData\PrjData.xlsx", "BrCTCopy", true) While Not Driver.EOF copyname= DDT.CurrentDriver.Value(1) BrParent= DDT.CurrentDriver.Value(0) for i=0 to defBr.ChildCount*20 copypartarr = defBr.FindAllChildren(Array("Text","ClrFullClassName"),Array(copyname,"System.Windows.Controls.TextBlock"),50) for each copypart in copypartarr 'Sys.HighlightObject copypart BrcParent=copypart.DataContext.Parent.Name if (BrcParent=BrParent) then copypart.ClickR defBr.PopupMenu.Click("Copy") ParamFoundBool=True pastename= DDT.CurrentDriver.Value(2) if Not(pastename="NA") then for j=0 to defBr.ChildCount*20 set pastepart= defBr.FindChild(Array("Text","ClrFullClassName","WPFControlName"),Array(pastename,"System.Windows.Controls.TextBlock","BCName"),50) 'Sys.HighlightObject pastepart if(pastepart.Exists) then pastepart.ClickR defBr.PopupMenu.Click("Paste") PasteFoundBool=True end if exit for next defBr.MouseWheel(-1) end if If PasteFoundBool=True then Exit for end if end if If ParamFoundBool=True then Exit for End if next defBr.MouseWheel(-1) If ParamFoundBool=True then Exit for End if next Call Driver.Next() WEND Call DDT.CloseDriver(Driver.Name) End Function
Related Content
- 4 months agoD0UG