Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Accessing the text value of a node using visual basic

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
gaurav517



Joined: 30 Jul 2008
Posts: 14
Location: Switzerland

PostPosted: Wed Jul 30, 2008 10:20 am    Post subject: Accessing the text value of a node using visual basic Reply with quote

hi,

I am working on automated testing of applications.
The application, for which I am trying to implement the automated testing, contains the infralution tree.
The tool I am using for automated testing is hp quick test professional.
Using this test tool, first we record a test for which visual basic script is generated. After, I put testing condition in this visual basic script.
I recorded the test for one module of the application under test.
The test tool identifies the whole infralution tree as an object. So, for an example, if I click on any row of the tree during recording, it generates the following code.
SwfWindow("EPC ToolSet, Version 2.3.0").SwfObject("tree").Click X,Y
But I need to retreive the text value corresponding to a cell, for which I can use the internal objects,methods and properties of the tree with the code
SwfWindow("EPC ToolSet, Version 2.3.0").SwfObject("tree").Object.<Internal object/method/properties>

For an example, I am attaching the snapshot with this post.

I went through the help section but I am not clear about some things. The most relevant paragraph was:

[
you can locate a row by specifying a "path" to the Row. The FindRow(path) method takes a list of items that define a path from the root item (or DataSource) to the Row to be found. Thus the first item in the "path" list should be a direct child of the DataSource , the second would be a grandchild and so on.
The FindRowByIndex(path) method is an alternative that allows you to define a path using positional indices. The path is an array of integers which represent the zero based index of a row within its parent row, thus the path {1, 4} would specify the fifth child of the second row under the root row.
]

The method FindRowByIndex() seems to be more convenient but the problem is the path. Can you please describe me with an example..what should be the path using positional indices which describe the selected row in snapshot. if we put the proper path, it returns the Row object corresponding to the path given.
or like in one earlier topic in this forum, GetRow,Columns and GetBindingForRow was used to retreive cell value. so, i used following code:
Set x = SwfWindow("EPC ToolSet, Version 2.3.0").SwfObject("tree")
Set row1 = x.Object.GetRow(4)
Set column1 = x.Object.Columns(2)
Set binding = x.Object.GetBindingForRow(row1)
if(binding <> null) Then
binding.GetCellData row1, column1, cellData
Set information = cellData.Value.ToString()
msgbox(information)

else
msgbox("There is no data binding")
end if

But i guess there is some problem with x.Object.Columns(1)
and can you elaborate more on the whether GetRow(4) is correct for the current situation.
Please suggest me, as the whole application is based on infralution tree and I should have clear understanding of this.
Also, I would like write an article regarding the automated testing of application involving infralution trees as I did not find anything related to this on the internet.

Hoping for your quick response,

Kumar Gaurav

The snapshot is below...
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Jul 30, 2008 10:33 pm    Post subject: Reply with quote

If you want to find the text associated with a cell at a given point on the screen then the best approach is probably to call GetWidget(x,y) this returns the widget (like a windowless control) at the given window coordinates. Note that if your X/Y are screen coordinates then you need to convert them to window coordinates using PointToClient eg

Code:
Dim tree as VirtualTree = x.Object
Dim p as Point = tree.PointToClient(new Point(X, Y))
Dim w as Widget = tree.GetWidget(p.X, p.Y)
if TypeOf w is CellWidget then
    Dim cw as CellWidget = w
    Dim text as String = cw.CellData.GetText()
end if

_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
gaurav517



Joined: 30 Jul 2008
Posts: 14
Location: Switzerland

PostPosted: Thu Jul 31, 2008 9:49 am    Post subject: thanks a ton Reply with quote

hey thanks a lot...
it worked..

I used following in my code:


Set internalTree = SwfWindow("EPC ToolSet, Version 2.3.0").SwfObject("tree").Object
Set widget = internalTree.GetWidget(311,57)
Set cellinformation = widget.CellData

msgbox(cellinformation)

and I got the text in the cell corresponding to point(311,57)

Thanking you again for your brilliant idea.... Very Happy
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group