Cannot access Button Control

Class library usage, coding and language questions.
ranettix
Posts: 20
Joined: Mon Aug 28, 2006 12:07 pm

Cannot access Button Control

Post by ranettix » Mon Oct 26, 2009 11:20 pm

When using the FindChildClassName method, there seems to be a problem with similar class names, as in the following example:

form = RxFormFindTitle("My Title Something", MATCH_FROM_START, TRUE, 1000);
button = RxFormFindChildClassName(form, "TButton #4");
RxMouseMoveToControl(button);
RxMouseClickControl(button);

There are several buttons with class name starting with "TButton ..".
Compilation is o.k., but during execution the handle "button" will access only the button
named "TButton #1".

How can I reach "TButton #4" ? :roll:

---------------------------------------------------------------------
Operating System Windows 2000 SP4
Ranorex Pro 1.2, C++
VCExpress 2005, under Windows XP SP3

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Cannot access Button Control

Post by Support Team » Tue Oct 27, 2009 9:55 am

The RxFormFindChildClassName function does not take the "#4" into account, it just checks for the classname ("TButton"), not the instance number. If you want to find the forth instance of "TButton" in your form, then specify a value for the classInstance argument in that function:
button = RxFormFindChildClassName(form, "TButton", 4); // find "TButton #4"
Regards,
Alex
Ranorex Support Team

ranettix
Posts: 20
Joined: Mon Aug 28, 2006 12:07 pm

Re: Cannot access Button Control

Post by ranettix » Wed Oct 28, 2009 5:56 pm

Since it is the 3rd instance, I took 3, which failed. 4 does work.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Cannot access Button Control

Post by Support Team » Thu Oct 29, 2009 9:13 am

If you see "TButton #X" (X being a number) in Ranorex Spy, that means it's the Xth instance and you should have to take 'X' as the instance number.

Regards,
Alex
Ranorex Support Team