Convert gridView to iList

Class library usage, coding and language questions.
minroNET
Posts: 1
Joined: Mon May 23, 2011 7:23 pm

Convert gridView to iList

Post by minroNET » Mon May 23, 2011 7: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 1234 times

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Convert gridView to iList

Post by Ciege » Mon May 23, 2011 7: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
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Convert gridView to iList

Post by Support Team » Mon May 23, 2011 10: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
.
Image