Unable to recognize element in grid

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
pksy
Posts: 10
Joined: Fri Dec 16, 2011 7:06 pm

Unable to recognize element in grid

Post by pksy » Wed Jan 18, 2012 8:01 pm

Hi,

I've been using RanorexSpy for a while and I've been able to successfully track elements. But there's on part of my application where it can't seem to recognize the columns/rows in a grid. I can only seem to recognize the whole grid as a whole and RanorexSpy sees this grid as a "Janus.Windows.GridEX.GridEX".

I've searched through forums regarding this and is my issue similar to issues people have where the solution is to use InvokeRemotely? If so, is there a tutorial for beginners regarding on how to use InvokeRemotely for a Janus.Windows.GridEX.GridEX?

Thanks
PS

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Unable to recognize element in grid

Post by Support Team » Thu Jan 19, 2012 10:17 am

Hi,

Please take a look to following blog
http://www.ranorex.com/blog/transfering ... et-control

Regards,
Peter
Ranorex Team
.
Image

pksy
Posts: 10
Joined: Fri Dec 16, 2011 7:06 pm

Re: Unable to recognize element in grid

Post by pksy » Fri Jan 20, 2012 7:53 pm

I'm fairly new regarding this so please bear with me. In the link you provided, it's trying to get items from a ListView so it uses the following:

System.Windows.Forms.ListView remoteListView = (System.Windows.Forms.ListView)control;

For my case, would it be the following?

Janus.Windows.GridEX.GridEX grid = (Janus.Windows.GridEX.GridEX)control;

Thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Unable to recognize element in grid

Post by Support Team » Mon Jan 23, 2012 12:35 pm

Hi,

Please take another look to this post. There will be explained how you use the invoke.
http://www.ranorex.com/forum/invokeremo ... t1002.html

Regards,
Peter
Ranorex Team
.
Image

pksy
Posts: 10
Joined: Fri Dec 16, 2011 7:06 pm

Re: Unable to recognize element in grid

Post by pksy » Thu Feb 02, 2012 12:13 am

I've made a lot of progress regarding this. So far I'm able to find a specific cell with a specific name. The part I'm stuck on is how do I right click that cell since I can't seem find such a command with GridEX. Or is there a way to convert a GridEXcell to a Ranorex.Cell?

I've copied and pasted my code below. I keep on getting the "Object reference not set to an instance of an object" error message.

***************
Ranorex.Control gridTest = repo.File_Window.Tab.File_Task_GridInfo.AbsolutePath.ToString();
Ranorex.Cell task = (Ranorex.Cell)gridTest.InvokeRemotely(GetDelegate);

task.Click(WinForms.MouseButtons.Right);

static object GetDelegate(System.Windows.Forms.Control control, object input)
{
GridEX grid = (control as GridEX);
grid.ExpandRecords();
GridEXRow parentRow = grid.GetRow();
GridEXRow[] childrenRow = parentRow.GetChildRows();

GridEXCellCollection cell = childrenRow[0].Cells;

foreach (GridEXCell item in cell)
{
if(item.Text == "some text")
{
return.item;
}
}
return null;
}

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Unable to recognize element in grid

Post by Support Team » Mon Feb 06, 2012 1:51 pm

Hi,

basically as described in this blog post only primitive types can be returned using InvokeRemotely.

So, you have to perform the click action within your method.
Therefore please have a look at the GridEXCell documentation.

Regards,
Tobias
Ranorex Support Team
.
Image