Mouse.ClickControl on button click-event does not work

Bug reports.
Schuco
Posts: 9
Joined: Thu Feb 21, 2008 4:16 pm
Location: Ternitz

Mouse.ClickControl on button click-event does not work

Post by Schuco » Thu Feb 21, 2008 4:20 pm

When performing following code on a button click ( button5 )

Code: Select all

Ranorex.Form form = Ranorex.Form.Active;
Ranorex.Button b1 = form.FindButton("button1");
Ranorex.Button b2 = form.FindButton("button2");
Ranorex.Mouse.ClickControl(b1);
Ranorex.Mouse.ClickControl(b2);
button1 gets the focus, but will not be clicked ...
What I've done wrong ?

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

Post by Support Team » Thu Feb 21, 2008 4:48 pm

Please check that the FindButton() method calls do not return null and that your buttons displayed correctly in the RanorexSpy (which is normally the case with buttons).

What kind of application are you automating: MFC, .NET, ... ?

It could help to use ClickControl() with "movetime" to check if the mouse is moving to the correct control.

Michael
Support Team

Schuco
Posts: 9
Joined: Thu Feb 21, 2008 4:16 pm
Location: Ternitz

Post by Schuco » Thu Feb 21, 2008 10:56 pm

It's a c# windows form.
The mouse is moving to button1 and the button gets the focus, but the click-event does not occur.

I'll try your suggestions tomorrow !
Thank you !

Schuco
Posts: 9
Joined: Thu Feb 21, 2008 4:16 pm
Location: Ternitz

Post by Schuco » Fri Feb 22, 2008 8:12 am

I've tried it, nothing, same effect, but no click - event occurs !

OK, button does not get the focus !
button2 gets the focus, from then it works even on button1, the first "Ranorex" - click after a human click does not work

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

Post by Support Team » Fri Feb 22, 2008 1:40 pm

I built a fake c# app with 2 buttons in it and a textbox to log the click.

The following code works for me:

Code: Select all

Form fake = Application.FindFormTitle("FakeApp");
Button b1 =  fake.FindButton("button1");
Button b2 = fake.FindButton("button2");

Mouse.ClickControl(b1);
Mouse.ClickControl(b2);
The only thing I can think of is your use of Form.Active. Try to use FindForm() instead.

If that doesnt work, please send your test app to [email protected].

Michael
Support Team