Hi
in a exceed-gridcontrol-cell is placed a Checkbox. Because of the exceed-cell, i have lost the control-level and have to work at element-level.
Problem:
If i try to activate the checkbox using "DoDefaultAction", nothing happens.
--> Only in Debug-Mode, when i place a breakpoint at the line where DoDefaultAction will be executed (and change the focus to visual studio ?) the checkbox will be activated.
Has everyone any idea ?
regards and thanks
Jörg
Checkbox at Element-Level no function
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
This could be a focus problem. Try to focus the element:
If that does not work, try focusing the control first:
Regards,
Alex
Ranorex Support Team
Code: Select all
element.Select(Selection.TakeFocus);
Code: Select all
Control control = element.Control;
control.Focus();
element.Select(Selection.TakeFocus);
Alex
Ranorex Support Team
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
If checking the CheckBox using DoDefaultAction works when you place a breakpoint in Studio, this should be a focus or timing problem.
Could you please insert a Sleep statement before executing DoDefaultAction:
The other thing that comes to my mind is checking that the application with the checkbox is active. Please, try to use Form.Activate on your application form before executing DoDefaultAction.
Regards,
Alex
Ranorex Support Team
Could you please insert a Sleep statement before executing DoDefaultAction:
Code: Select all
System.Threading.Thread.Sleep(1000); // milliseconds
element.DoDefaultAction();
Regards,
Alex
Ranorex Support Team
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
not a timing, but a (inverted ?) Focus-Problem. This works (but not practicable):
Application.FindFormTitle("Microsoft Visual C#",SearchMatchMode.MatchSubstring).Activate();
dc.Checked = true; //dc is a checkbox in "form"
form.Activate();
The checkbox is only activated, when i remove the the focus from the test-form to another form before i activate the checkbox. works also with change to other forms. This is why it works when setting a breakpoint at the "dc.Checked = true" line.
Application.FindFormTitle("Microsoft Visual C#",SearchMatchMode.MatchSubstring).Activate();
dc.Checked = true; //dc is a checkbox in "form"
form.Activate();
The checkbox is only activated, when i remove the the focus from the test-form to another form before i activate the checkbox. works also with change to other forms. This is why it works when setting a breakpoint at the "dc.Checked = true" line.
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
This is really some weird behavior. Seems like the control manufacturer did not properly implement the MSAA DoDefaultAction for that control.
Sorry, but you will need to use that workaround, i.e. activating some other window. Maybe focussing another control in your application under test works, too, so you don't have a dependency on another application.
Regards,
Alex
Ranorex Support Team
Sorry, but you will need to use that workaround, i.e. activating some other window. Maybe focussing another control in your application under test works, too, so you don't have a dependency on another application.
Regards,
Alex
Ranorex Support Team
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
If you execute DoDefaultAction with AccExplorer, the focus is on the AccExplorer application, not on your application under test (AUT). And the problem is that DoDefaultAction does not work when the focus is on the AUT. So, I don't see any advantage in using AccExplorer ...
I had a look on the source code of the Element.DoDefaultAction method and it does nothing but calling the MSAA DoDefaultAction interface function.
Why don't you use the Mouse to click on the checkbox instead of using the Element.DoDefaultAction method? Clicking with the mouse is the most realistic way, DoDefaultAction heavily depends on the MSAA implementation of the control.
Regards,
Alex
Ranorex Support Team
I had a look on the source code of the Element.DoDefaultAction method and it does nothing but calling the MSAA DoDefaultAction interface function.
Why don't you use the Mouse to click on the checkbox instead of using the Element.DoDefaultAction method? Clicking with the mouse is the most realistic way, DoDefaultAction heavily depends on the MSAA implementation of the control.
Regards,
Alex
Ranorex Support Team