Convert gridView to iList : Automation API

Convert gridView to iList

Class library usage, coding and language questions.

Convert gridView to iList

Postby minroNET » Mon May 23, 2011 8:27 pm

Hello,

I am new to Ranorex, so I am sorry if my question is trivial.

I have a grid view collection (at least I think it is a grid view) and I need to iterate over it to access particular elements.

Now, I tried to convert it to IList (I need it to be iterable) but for some reason it does not work. Any ideas what am I doing wrong?

Code:

IList<Ranorex.Row> myRows = COlistOfRows.FindDescendants<Ranorex.Row>();





COlistOfRows is the highlighted element. I am using Ranorex 3.01.

Thank you
Attachments
GridViewSpy.png
GridViewSpy.png (36.42 KiB) Viewed 163 times
minroNET
 
Posts: 1
Joined: Mon May 23, 2011 8:23 pm

Re: Convert gridView to iList

Postby Ciege » Mon May 23, 2011 8:35 pm

First, you say it does not work, can you elaborate as to what does not work means to you?

Second, according to the screenshot of Ranorex Spy you have listed there, there are no (visible) Ranorex.Row objects. So searching for all the descendant Ranorex.Row objects or COlistOfRows would return 0, since there are none to be found.

If you look two objects up from COlistOfRows, you see how Ranorex Spy displays a Row object.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...
User avatar
Ciege
 
Posts: 965
Joined: Thu Oct 16, 2008 7:46 pm
Location: Arizona, USA

Re: Convert gridView to iList

Postby Support Team » Mon May 23, 2011 11:31 pm

Hello,

please use the Spy to create a path that lists all your rows. Then use this same path in code like this:

IList<Ranorex.Row> rows = Host.Local.Find("/full/path/to/all/rows/here");
foreach (Ranorex.Row r in rows)
            	r.Click();


Instead of Host.Local you can use the adapter class of a unique containing element together with a relative path to all rows.

Regards,
Roland
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4839
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests