| View previous topic :: View next topic |
| Author |
Message |
tkondal
Joined: 03 Nov 2006 Posts: 24
|
Posted: Thu Nov 09, 2006 6:57 pm Post subject: TreeView with Checkboxes |
|
Hi, I'm testing an application that contains a TreeView with Checkboxes.
The RanorexSpy tool tells me that my Control is a TreeView. The Element section in the tool says that I have a CheckButton (role).
My problem comes when I try to check that checkbox, it doesn't do it. There is no default action associated with it that can let me check the button.
Any ideas? |
|
| Back to top |
|
 |
tkondal
Joined: 03 Nov 2006 Posts: 24
|
Posted: Thu Nov 09, 2006 8:04 pm Post subject: |
|
| I forgot to mention that I have tried sending mouse clicks and button checks. These only select the item in the treeview, they don't set the check. |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Thu Nov 09, 2006 10:25 pm Post subject: |
|
I would suggest the following:
Select the element with MouseClickElement and then do the same what you normally do in the application if you set the checkbox.
Use the ControlSendKeys() function for keyboard events and the MouseClick() functions for mouse events.
Send us a sample application with the treeview if it doesn't work.
Jenö Herget
Ranorex Team |
|
| Back to top |
|
 |
tkondal
Joined: 03 Nov 2006 Posts: 24
|
Posted: Mon Nov 13, 2006 3:46 pm Post subject: |
|
I tried what you said and it didn't work for me. I think I know why. I am doing the following to trigger the check:
Code: click into code to enlarge
element = Ranorex.ControlGetElement(hAppWindow);
item = Ranorex.ElementFindChild(element, Ranorex.ROLE_SYSTEM_CHECKBUTTON, 'element 1');
Ranorex.ControlSendKeys(item[0], ' ');
Note that I have used item[0]. From what I understood, the first element of the element tuple was the handle to that element. When I put the numerical value of the handle, as given by Ranorex Spy, it works.
Code: click into code to enlarge
element = Ranorex.ControlGetElement(hAppWindow);
item = Ranorex.ElementFindChild(element, Ranorex.ROLE_SYSTEM_CHECKBUTTON, 'element 1');
Ranorex.ControlSendKeys(1444948, ' ');
Am I wrong in assuming that the first tuple element is a handle? Because I noted that when I printed that value (item[0]), it gave me a 6 digit number that could not be found by RanorexSpy. |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Mon Nov 13, 2006 11:32 pm Post subject: |
|
You don't need to use the tuple element (item[0]). It's better to find first the tree view control in the application with the FormFindChild functions and then the element in the tree view control with ElementFindChild.
An application can have hundreds of elements but normally only few controls.
The ElementTest.py sample demonstrates this way with a checked list box:
Code: click into code to enlarge
// Find the checked listbox control in the application
checkedListBox=Ranorex.FormFindChildControlName(hAppWindow,'checkedLis tBox1')
if checkedListBox == 0:
print 'ERROR: checkedListBox not found'
return 1
print ' moving the mouse to the control'
Ranorex.MouseMoveToControl(checkedListBox)
print ' searching the element Item2 in the checkedListBox'
element=Ranorex.ControlGetElement(checkedListBox)
item2 = Ranorex.ElementFindChild(element, Ranorex.ROLE_SYSTEM_CHECKBUTTON, 'Item2')
if item2 == None:
print 'ERROR: Item2 not found'
return 1
print ' moving the mouse to item2 and selecting it'
Ranorex.MouseClickElement(item2)
print ' calling the default action'
Ranorex.ElementDoDefaultAction(item2)
| tkondal wrote: |
| Am I wrong in assuming that the first tuple element is a handle? |
That's wright, the first tuple element is the handle of the control.
Can it happen that you have two controls with an 'element 1' in it?
Jenö Herget
Ranorex Team |
|
| Back to top |
|
 |
tkondal
Joined: 03 Nov 2006 Posts: 24
|
Posted: Tue Nov 14, 2006 3:15 pm Post subject: |
|
Hi Jenö,
I figured out the problem after all. Yes, the handle that I got was in fact correct. The problem was that the ControlSendkeys() was not captured by the parent control. The parent control was responsible of treating keys not the actual child that I was targeting.
So, to fix the problem, I selected my treeView element as before, but this time, I sent the ControlSendKeys to the treeView, not the treeView element.
This is why, we need a capture-replay tool fast Any chance of providing a beta or something, soon?
Thanks. |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Tue Nov 14, 2006 11:21 pm Post subject: |
|
| tkondal wrote: |
| This is why, we need a capture-replay tool fast. Any chance of providing a beta or something, soon? |
I'm sorry, but i think we will have the first beta only next year.
Jenö Herget
Ranorex Team |
|
| Back to top |
|
 |
|