Forum Discussion

ngoodman's avatar
ngoodman
New Contributor
11 years ago

Alias a Mapped Object Under a Different Parent Object

Question



Using TC 10, I notice that I am unable to drag and drop an Alias to any position within the Alias tree. Instead, I can only place aliases as a child of other Aliases which are in the objects inheiretance tree.



During drag-and-drop, a white circle with a slash through it indicates that I am not allowed to put the alias at any arbitrary location.



Why is this so? If I edit the tcMN XML file directly, I can place aliases anywhere I want. Doesn't this defeat the purpose of Aliasing?



Example



Before you ask "why would you want to do that," here is a simple example of why this feature is needed:



In Java, menu bars, menus, and menu items (java.awt.Component) are not represented in the object model the way one would expect.



The MenuBar class contains top-level menus (e.g. "File", "View", "Help"), and when each of these items is clicked, it displays a list of MenuItem's. However, these MenuItem's are rendered under a shared PopupMenu object. Every single click of a menu from the MenuBar uses the same PopupMenu object, and this object is a sibling, not a child of the MenuBar.



This means, if I want to navigate the menu File > Print, I have to:



Aliases.MainWindow.MenuBar.File.Click();

Aliases.MainWindow.PopupMenu.FilePrint.Click();



The MainWindow.PopupMenu would then contain every single MenuItem used in the application. This list can be very long, and is somewhat counter intuitive.



By hacking the XML file, I am able to get the desired result:



Aliases.MainWindow.MenuBar.File.Click();

Aliases.MainWIndow.MenuBar.File.Print.Click();





No RepliesBe the first to reply