Forum Discussion

mikev's avatar
mikev
Contributor
13 years ago

Java ToolBar Issues

Evaluating TC right now, and I've run into a problem:




This is what I'm trying to solve:

 

Aliases.MyApp.MyToolbar.SwingObject("JToolBar$1", "", 1); -
This is a save button on the toolbar.



Aliases.MyApp.MyToolbar.SwingObject("JToolBar$1", "", 2); -
This is a print button on the toolbar.



Aliases.MyApp.MyToolbar.SwingObject("JToolBar$1", "", 3); -
This is a exit button on the toolbar.

 

The index isn't good.  If things are added/deleted, they may
not be the ones that we think they are.

 

So, if I'm in Object Browser for one of the above objects, I
can go to the Fields tab.  From there, I see a field "action_2".  I click the
browse button to the right.  I now see some Fields.  I click the Properties
tab.  Voila, I see some information that I can actually use:  JavaClassName =
PrintComponent and JavaFullClassName =
com.actions.PrintComponent.

 

Now that information I can use to uniquely identify each
button on the toolbar.  I can't figure out how to do that.  I've read on the
support pages about fields.  I've read about everything that I could find to
solve this problem.  I've been swearing a lot.  If I can figure out how to do
this, it should help with other code that I need to write.

 

I'm stuck.





1 Reply

  • Hi,


    You can map the print button object by using the needed properties (for example, the properties you mentioned - JavaClassName or JavaFullClassName). TestComplete will use these properties to identify the object during the test recording and playback.


    In the same way, you can map other application objects.