| View previous topic :: View next topic |
| Author |
Message |
Schuco
Joined: 21 Feb 2008 Posts: 9 Location: Ternitz
|
Posted: Thu Feb 21, 2008 5:20 pm Post subject: Mouse.ClickControl on button click-event does not work |
|
When performing following code on a button click ( button5 )
Code: click into code to enlarge
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 ? |
|
| Back to top |
|
 |
Support Team Site Admin
Joined: 07 Jul 2006 Posts: 200
|
Posted: Thu Feb 21, 2008 5:48 pm Post subject: |
|
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 |
|
| Back to top |
|
 |
Schuco
Joined: 21 Feb 2008 Posts: 9 Location: Ternitz
|
Posted: Thu Feb 21, 2008 11:56 pm Post subject: |
|
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 ! |
|
| Back to top |
|
 |
Schuco
Joined: 21 Feb 2008 Posts: 9 Location: Ternitz
|
Posted: Fri Feb 22, 2008 9:12 am Post subject: |
|
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 |
|
| Back to top |
|
 |
Support Team Site Admin
Joined: 07 Jul 2006 Posts: 200
|
Posted: Fri Feb 22, 2008 2:40 pm Post subject: |
|
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: click into code to enlarge
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 support@ranorex.com.
Michael
Support Team |
|
| Back to top |
|
 |
|