Micro Focus QTP (UFT) Forums
Runtime java object arrays - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Runtime java object arrays (/Thread-Runtime-java-object-arrays)



Runtime java object arrays - EclipseDev - 07-02-2008

Version: QTP 9.5 + Java add-in
Application tested: Eclipse RCP

I have noticed the Object property gives me access to the underlying Java object. This seems an interesting capability, but I couldn't see how to retrieve items from java arrays. What is the syntax for that?

For instance:

Code:
JavaTree("Tree").Object.getSelection() returns (in Java) a TreeItem[], how can I access its elements in the vb script, as well as the array length? I couldn't find a syntax that works:
JavaTree("Tree").Object.getSelection()[0]
JavaTree("Tree").Object.getSelection()(0)
JavaTree("Tree").Object.getSelection().get(0)
JavaTree("Tree").Object.getSelection().item(0)
...
:all of these fail.

Thanks.