Janus GridEX cell recognition
Janus GridEX cell recognition
Hi,
Our company uses Janus.Windows.GridEX.v3 sporadically throughout its code. However using Ranorex Spy will not detect the cells in the grid.
How can I retrieve the text from a single cell from this GridEX control??
Attached is a snapshot of an example of where we use GridEX control.
Our company uses Janus.Windows.GridEX.v3 sporadically throughout its code. However using Ranorex Spy will not detect the cells in the grid.
How can I retrieve the text from a single cell from this GridEX control??
Attached is a snapshot of an example of where we use GridEX control.
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Janus GridEX cell recognition
Hi,
Thanks for the snapshot!
It seems that this container is one of your custom classes, because the type is "Tsd.IncManagement.Workstation.SIMS.Common.UtcGridEx".
Does it derive from a Janus control? Please send us some more information about the specific control.
Aren't you able to identify anything in the specific container? Would it be possible to send us a Ranorex Snapshot file of the entire application?
Regards,
Markus
Ranorex Support Team
Thanks for the snapshot!
It seems that this container is one of your custom classes, because the type is "Tsd.IncManagement.Workstation.SIMS.Common.UtcGridEx".
Does it derive from a Janus control? Please send us some more information about the specific control.
Aren't you able to identify anything in the specific container? Would it be possible to send us a Ranorex Snapshot file of the entire application?
Regards,
Markus
Ranorex Support Team
Re: Janus GridEX cell recognition
Hi Markus,
Thanks for looking at this.
To answer your questions ... yes "UtcGridEx" derives from "Janus.Windows.GridEX.GridEX".
No I am not able to see anything in this specific container (cannot see rows or cells)
Have attached snapshot of the whole application.
Thanks
Brad.
Thanks for looking at this.
To answer your questions ... yes "UtcGridEx" derives from "Janus.Windows.GridEX.GridEX".
No I am not able to see anything in this specific container (cannot see rows or cells)
Have attached snapshot of the whole application.
Thanks
Brad.
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Janus GridEX cell recognition
Hi Brad,
The specific grid element is based on WinForms and WinForms uses Microsoft Active Accessibility (MSAA) to create accessible code, so you can check with the AccExplorer/UISpy (the MSAA Accesibility Explorer) if the MSAA implementation is correctly working, just check if the tool is able to identify the specific elements in your grid.
If it is able to identify the elements within the container, it seems that there is a problem with Ranorex, if it is not able it seems that the implementation of MSAA is not correct and
therefore has to be re-implemented. There is also a useful blog about this topic:
http://www.ranorex.com/blog/enabling-au ... s-controls
It is also possible to invoke specific methods of a control, maybe you can create a methods which returns specific elements, but you have to consider that the elements have to be serializable.
Regards,
Markus
Ranorex Support Team
The specific grid element is based on WinForms and WinForms uses Microsoft Active Accessibility (MSAA) to create accessible code, so you can check with the AccExplorer/UISpy (the MSAA Accesibility Explorer) if the MSAA implementation is correctly working, just check if the tool is able to identify the specific elements in your grid.
If it is able to identify the elements within the container, it seems that there is a problem with Ranorex, if it is not able it seems that the implementation of MSAA is not correct and
therefore has to be re-implemented. There is also a useful blog about this topic:
http://www.ranorex.com/blog/enabling-au ... s-controls
It is also possible to invoke specific methods of a control, maybe you can create a methods which returns specific elements, but you have to consider that the elements have to be serializable.
Regards,
Markus
Ranorex Support Team
Re: Janus GridEX cell recognition
Hi Markus,
I have tried your latter suggestion of using remote invocation.
My code I have attempted is as follows:
I am gettting the following error: "Action 'invokeremotely' failed on element '{Container: grxEvents}'. Unable to cast object of type 'System.Int32' to type 'System.String'.
Can you offer any suggestion?
I have tried your latter suggestion of using remote invocation.
My code I have attempted is as follows:
Code: Select all
public void CheckData()
{
Ranorex.Control gridcontrol = "/form[@controlname='frmMain']/container[@controlname='cwtcMain']/container[@controlname='TrafficIncidentMainControl']/element/container[@controlname='explNotifications']/container/container/container[@controlname='grxEvents']";
SOutputData[] outputData = (SOutputData[]) gridcontrol.InvokeRemotely(delegate(System.Windows.Forms.Control control, object input)
{
Janus.Windows.GridEX.GridEX currGrid = (Janus.Windows.GridEX.GridEX) control;
List<SOutputData> remoteOutputData = new List<SOutputData>();
foreach (GridEXRow currRow in currGrid.GetRows())
{
int counter = 0;
SOutputData data = new SOutputData();
data.cellText = (string) currRow.Cells[counter].Value;
remoteOutputData.Add(data);
counter++;
}
return remoteOutputData.ToArray();
});
}
[Serializable]
private class SOutputData
{
public string cellText;
}
Can you offer any suggestion?
Re: Janus GridEX cell recognition
I also installed UISpy and could only find the control pane for GridEX Control, but there was no structure under it. (eg. no rows or cells)
Also ... how do you re-implement MSAA?
Also ... how do you re-implement MSAA?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Janus GridEX cell recognition
Hi,
http://www.ranorex.com/blog/enabling-au ... s-controls
Regards,
Peter
Ranorex Team
To support accessibility of your control, please take a look to following postbsing wrote:Also ... how do you re-implement MSAA?
http://www.ranorex.com/blog/enabling-au ... s-controls
Regards,
Peter
Ranorex Team
Re: Janus GridEX cell recognition
Can someone look at the code I posted, to see why it doesn't work?? I don't really understand the MSAA stuff.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Janus GridEX cell recognition
Hi,
It is not so easy to point you in the right direction without knowledge of your system, but try to use this code instead of yours:
Maybe your developers can help you with the implementation of accessibility?
Regards,
Markus
Ranorex Support Team
It is not so easy to point you in the right direction without knowledge of your system, but try to use this code instead of yours:
use: data.cellText = currRow.Cells[counter].Value.toString(); instead of: data.cellText = (string) currRow.Cells[counter].Value;Does this solve the problem?
Maybe your developers can help you with the implementation of accessibility?
Regards,
Markus
Ranorex Support Team
Re: Janus GridEX cell recognition
Thanks Markus, yes it solves that error message.
My code now looks like this
Now I am getting error message "Action 'invokeremotely' failed on element '{Container.grxEvents}'. Object reference not set to an instance of an object."
I have tried to debug this but Ranorex will not step through the delegate. Do you have any suggestions which will fix the object instance error?
My code now looks like this
Code: Select all
[Serializable]
private class SOutputData
{
public string cellText;
}
public void CheckData()
{
Ranorex.Control gridcontrol = "/form[@controlname='frmMain']/container[@controlname='cwtcMain']/container[@controlname='TrafficIncidentMainControl']/element/container[@controlname='explNotifications']/container/container/container[@controlname='grxEvents']";
SOutputData[] outputData = (SOutputData[]) gridcontrol.InvokeRemotely(delegate(System.Windows.Forms.Control control, object input)
{
Janus.Windows.GridEX.GridEX currGrid = (Janus.Windows.GridEX.GridEX) control;
List<SOutputData> remoteOutputData = new List<SOutputData>();
foreach (GridEXRow currRow in currGrid.GetRows())
{
for (int counter = 0; counter < currRow.Cells.Count; counter++)
{
SOutputData data = new SOutputData();
data.cellText = currRow.Cells[counter].Value.ToString();
Report.Info("test", data.cellText);
remoteOutputData.Add(data);
}
}
return remoteOutputData.ToArray();
});
}
I have tried to debug this but Ranorex will not step through the delegate. Do you have any suggestions which will fix the object instance error?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Janus GridEX cell recognition
Hi,
You're welcome!
It is very hard for us to find the error without knowledge of your Control, so would it be possible that you send us a small sample application which includes that control and some test data?
This would help us solving the issue.
You can also send it to [email protected].
Regards,
Markus
Ranorex Support Team
You're welcome!
It is very hard for us to find the error without knowledge of your Control, so would it be possible that you send us a small sample application which includes that control and some test data?
This would help us solving the issue.
You can also send it to [email protected].
Regards,
Markus
Ranorex Support Team
Re: Janus GridEX cell recognition
Hi Markus,
I would prefer not to send an application ... you could just get a trial version of the control.
Cheers,
Brad.
I would prefer not to send an application ... you could just get a trial version of the control.
Cheers,
Brad.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Janus GridEX cell recognition
Hello
I just downloaded the trial Version from Janus GridEx and worked with GridExTutorial1.
Ranorex is able to spy all cell data perfectly.
It seems that your derived version from Janus GridEx does not care about Accessibility (MSAA).
The recommended way is to implement Accessibility functionality as described in the article (cited more times above).
Using the workaround to retrieve the cell contents with the use of InvokeRemotely-Function within Ranorex does work as well. Your code snippet was quite correct with the exception of your Ranorex-Report-Call within the Invoke-Remotely-Call. It is not possible to access the Report-Method within the Remote Call !
Please have a look at my example, where I extended your code snippet with Data-Type-Definition:
Extend your uses-clause
Serializable Output-Data with Type-Definition
Invoke-Remotely
Handle the output-data
Hope that helps !
Regards
Roland (E),
Ranorex Support Team
I just downloaded the trial Version from Janus GridEx and worked with GridExTutorial1.
Ranorex is able to spy all cell data perfectly.
It seems that your derived version from Janus GridEx does not care about Accessibility (MSAA).
The recommended way is to implement Accessibility functionality as described in the article (cited more times above).
Using the workaround to retrieve the cell contents with the use of InvokeRemotely-Function within Ranorex does work as well. Your code snippet was quite correct with the exception of your Ranorex-Report-Call within the Invoke-Remotely-Call. It is not possible to access the Report-Method within the Remote Call !
Please have a look at my example, where I extended your code snippet with Data-Type-Definition:
Extend your uses-clause
Code: Select all
using Janus.Windows.GridEX;
using Janus.Windows.Common;
Code: Select all
[Serializable]
[Serializable]
private class SOutputData
{
public ColumnType ColType;
public string cellString;
public bool cellBool;
}
Code: Select all
// Create Control Adapter
Control tableGridEX1 = "/form[@controlname='Form1']/container[@controlname='gridEX1']";
// Invoke Remotely
SOutputData[] outputData = (SOutputData[]) tableGridEX1.InvokeRemotely (delegate(System.Windows.Forms.Control control, object input)
{
// Get Grid Access
Janus.Windows.GridEX.GridEX currGrid = (Janus.Windows.GridEX.GridEX) control;
List<SOutputData> remoteOutputData = new List<SOutputData>();
// Iterate through Rows and Cells
foreach (GridEXRow currRow in currGrid.GetRows())
{
for (int counter = 0; counter < currRow.Cells.Count; counter++)
{
SOutputData data = new SOutputData();
// Specify Data-Type of Cell
data.ColType = currRow.Cells[counter].CellDisplayType;
// Save Value DataTypeSpecific
switch (data.ColType){
case ColumnType.CheckBox : data.cellBool = (bool)currRow.Cells[counter].Value; break;
case ColumnType.Text : data.cellString = currRow.Cells[counter].Text; break;
default: break;
}
remoteOutputData.Add(data); // AddToList
}
}
return remoteOutputData.ToArray(); // Return Data
});
Code: Select all
// Handle output
foreach (SOutputData MyOutPut in outputData){
switch (MyOutPut.ColType){
case ColumnType.Text: Report.Info("TextValue: " + MyOutPut.cellString); break;
case ColumnType.CheckBox: Report.Info("BoolValue: " + MyOutPut.cellBool.ToString()); break;
default: break;
}
}
Regards
Roland (E),
Ranorex Support Team
Re: Janus GridEX cell recognition
Thanks Roland ... this is brilliant!
The only changes I had to make to your code to get it working was:
and
Thanks heaps
Brad.
The only changes I had to make to your code to get it working was:
Code: Select all
Control tableGridEX1 .. changed to Ranorex.Control
Code: Select all
data.ColType = currRow.Cells[counter].CellDisplayType; ... changed to data.ColType = currRow.Cells[counter].Column.ColumnType;
Brad.