Page 1 of 1

Accessing data in custom MFC C++ control

Posted: Fri Jan 18, 2013 6:39 pm
by tcalderwood
We have a custom drawn MFC C++ control that we rely on to display information to the user. The information in the custom drawn box is filled with text. I was told at one time that we just needed to add in a hook to access this information. However, I can not find the example code that I thought I had. Has anybody had luck adding a hook to get at data in a custom drawn control and if so, can I get a copy of your source code please?

Re: Accessing data in custom MFC C++ control

Posted: Mon Jan 21, 2013 9:37 am
by sdaly

Re: Accessing data in custom MFC C++ control

Posted: Mon Jan 21, 2013 9:30 pm
by tcalderwood
That almost works! We can get the data out of the custom control just like the article described. The problem is that our custom control contains a set of text box custom controls and Ranorex does not distinguish between these text box custom controls. It lumps all the text data together.

I have attached a screen capture of the custom control below.
Capture.png


The outer control is called the Tabular Display. Within the Tabular Display, you have individual Tabular Display Blocks (TD Block). Each TD Block has it own set of text/data that we need access. The way Ranorex sees the data is as follows.
ElementDisplay.png
We would really like to be able to grab the data by individual TD Blocks instead of having to parse through the data as some data is dynamic over time. Do you know if this is possible?

Re: Accessing data in custom MFC C++ control

Posted: Tue Jan 22, 2013 5:53 pm
by Support Team
Hello,

That's not so easy to achieve because the rawText elements are listed in the same node and there is no element for the cell in your table.
Which version of Ranorex do you use?
Are there some other properties which can be used to find out the current cell?
Could you please send us a snapshot file from your Element in order to analyze your element.
Thank you!

Regards,
Bernhard

Re: Accessing data in custom MFC C++ control

Posted: Wed Feb 27, 2013 8:42 pm
by tcalderwood
We are currently using Ranorex 4.0.1.21107. There is nothing specific that we can use easily use. Is there a COM+ option that would allow us to access each block? As per the screenshot, I am not sure what your asking for. As soon as I figure that out, I will post it here. Thanks for your help.

Re: Accessing data in custom MFC C++ control

Posted: Thu Feb 28, 2013 5:26 pm
by Support Team
Hello,

In order to create a Ranorex Snapshot file please read the following section in our user guide:
http://www.ranorex.com/support/user-gui ... files.html

Thank you!
Regards,
Bernhard

Re: Accessing data in custom MFC C++ control

Posted: Thu Feb 28, 2013 9:39 pm
by tcalderwood
Attached is a snapshot that you requested. What we are trying to do is access each "block" of data found in element '59649'. In the attached screen capture, you can see the first 2 blocks with data, the rest of the blocks are blank.

Back when we first looked at Ranorex at StarEast, I was told that there was a COM+ way to add a hook that would allow us to access each block independently. Is that still an option on the table?

Re: Accessing data in custom MFC C++ control

Posted: Fri Mar 01, 2013 3:39 pm
by Support Team
Hello,

Thank you for the snapshot file.
I have seen that there is an attribute named "Column".
You will find all elements within this column using the following RanoreXPath:
/form/container/form/element/element[@controlid='59649']/rawtext[@column='0']
I'm afraid that you have to write some code to get the elements separated by the blocks in your test script.
Can you remember which guy told you to set a hook in order to split the blocks?
Thank you!

Regards,
Bernhard