Forum Discussion

Oferv's avatar
Oferv
Super Contributor
14 years ago

Only first tab is clickable

Hi,



when trying to right click on a tab i can see that only the first tab is click able.the line i use to click a tab is:



Aliases["Desktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["AssemblyViewTabControl"]["Grid"]["Grid1"]["UserControl"]["UserControl"]["TabItem"]["UserControl"]["WPFObject"]("StackPanel", "", 1)["WPFObject"]("TextBlock", "TabName", 1)["ClickR"]()



If the tab name is the first tab's name the right click perform without any problem but, if i cahnge the tab name to the second,third...... the right click doesn't perform and i'm getting this error message in the results file:




Type Message Time Priority Has Picture Link

Unable to find the object WPFObject("TextBlock", "TabNamel", 1). See Additional Information for details. 13:03:46 Normal



Why is that?What TC is using in order to identify where to right click(of course i rather using the tab name and not coordinates).



thanks


2 Replies

  • Oferv's avatar
    Oferv
    Super Contributor
    If there's only one tab Tc is able to click it by its name,if i'll close and open different tab with different name and just change the tab name Tc will be able to click it as well but,if i'll add two tabs so the application will hold now two current tabs TC won't be able to click the second one buy it's name only the first one.



    why is that?
  • Ofer,



    In your code, the tab is addressed by the class name, header and index:



    Aliases["Desktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["AssemblyViewTabControl"]["Grid"]["Grid1"]["UserControl"]["UserControl"]["TabItem"]["UserControl"]["WPFObject"]("StackPanel", "", 1)["WPFObject"]("TextBlock", "TabName", 1)["ClickR"]()



    So, if you have two tabs with the same header, you need to use different indexes to address them, for example, try using ["WPFObject"]("TextBlock", "TabName", 2) to obtain the second tab.



    You can find more information here: Addressing Windows, Controls and Objects of WPF Applications.



    I hope this helps.