Expanding a Flex Tree

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Jonathan
Posts: 8
Joined: Wed Nov 10, 2010 9:36 pm
Location: Minnesota, USA

Expanding a Flex Tree

Post by Jonathan » Wed Nov 10, 2010 10:06 pm

We have a flex component to test that has a dynamically loading tree, where the children are only loaded into the tree when their parent node is expanded. However when I run TreeItem.expand() the tree item is expanded, but the children are not loaded. From my understanding there must be an event fired when a user clicks to expand, that is not fired when Ranorex tells the flex component to expand.

I am trying to avoid clicking on the relative pixel location for expanding the item (left side triangle) since it varies depending on depth and the contents of the tree change and can be rearranged.

Is there any other way for me to trigger this event?


Thanks,

-Jonathan

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Expanding a Flex Tree

Post by artur_gadomski » Thu Nov 11, 2010 7:48 am

Can you expand the tree element by double clicking on it?

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

Re: Expanding a Flex Tree

Post by Support Team » Thu Nov 11, 2010 10:58 am

Hi,

Please could you post us a Ranorex Snapshot of the tree control, so we can take a deeper look on it.
http://www.ranorex.com/support/user-gui ... html#c2072

Thanks in advance.

Regards,
Peter
Ranorex Team

Jonathan
Posts: 8
Joined: Wed Nov 10, 2010 9:36 pm
Location: Minnesota, USA

Re: Expanding a Flex Tree

Post by Jonathan » Thu Nov 11, 2010 2:53 pm

@Artur - Double clicking doesn't expand

I've included a snapshot of the state of the item (and tree) as it is when the tree is opened
You do not have the required permissions to view the files attached to this post.

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

Re: Expanding a Flex Tree

Post by Support Team » Mon Nov 15, 2010 12:36 pm

Hi,

Sorry for the late response. If you click on the tree without Ranorex, the tree expands and the dynamically items will be generated, right? Are you working with code or Ranorex Recorder? If you working with code, please ask you developers how this tree works internally, maybe you have to trigger an event to create the items under the root.

Regards,
Peter
Ranorex Team

Jonathan
Posts: 8
Joined: Wed Nov 10, 2010 9:36 pm
Location: Minnesota, USA

Re: Expanding a Flex Tree

Post by Jonathan » Mon Nov 15, 2010 2:48 pm

I'm working with code, and if I could trigger the itemOpening event for the flex tree item I am clicking I believe it would work, however I'm not sure how to trigger an internal flex event from Ranorex.

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

Re: Expanding a Flex Tree

Post by Support Team » Mon Nov 15, 2010 2:57 pm

Hi,

I think you should just use the same action which you would execute manually. I think your developers have implemented an event for the OnClick method to expand the tree and dynamically load the tree. If you call on the expand() method for the tree, the other method "LoadDynamicallyData" or kind of, which dynamically loads the tree, will not be executed. Have you tried yet to code the actions, which you will execute as a "manual" tester?

Regards,
Peter
Ranorex Team

Jonathan
Posts: 8
Joined: Wed Nov 10, 2010 9:36 pm
Location: Minnesota, USA

Re: Expanding a Flex Tree

Post by Jonathan » Mon Nov 15, 2010 3:18 pm

They have a different onClick event which I believe I should be triggering by clicking on the tree item prior to calling expand(), however they have a flex itemOpening event (One of the events listed here under Events) trigger which calls the loadChildren method.

I know the itemOpening event is triggered when you click to expand (left side triangle) but that triangle is not recognizable as a separate object, and I want to avoid relying on clicking a pixel-based relative coordinate to make sure the mouse clicks the triangle.

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

Re: Expanding a Flex Tree

Post by Support Team » Mon Nov 15, 2010 3:26 pm

Hi,

If you want to click the triangle on the left side of the text, just use the Click method with following overload
http://www.ranorex.com/Documentation/Ra ... lick_2.htm
With this overload you can set a X Y coordinate which clicks on the triangle. Then the event should be fired.

For example:
Ranorex.TreeItem item = "yourPath";
item.Click(new Location(5,5));
Regards,
Peter
Ranorex Team

Jonathan
Posts: 8
Joined: Wed Nov 10, 2010 9:36 pm
Location: Minnesota, USA

Re: Expanding a Flex Tree

Post by Jonathan » Mon Nov 15, 2010 3:44 pm

Writing with pixel coordinates is what I was trying to avoid, namely because the location of the triangle changes.

Is there any way for me to directly trigger a flex event firing, similar to how normal events can be fired?

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

Re: Expanding a Flex Tree

Post by Support Team » Mon Nov 15, 2010 4:15 pm

Hi,

Sorry but it is not possible to fire an event. But there shouldn't be a problem when you use the coordinates for this issue. Because you use the relative coordinates of the element and not the "screen" location. This means, it is immaterial where the item is placed on the screen, Ranorex always use the rectangle of the element. So if you use the code i posted before, Ranorex clicks the position 5,5 of the element rectangle.

Regards,
Peter
Ranorex Team

Jonathan
Posts: 8
Joined: Wed Nov 10, 2010 9:36 pm
Location: Minnesota, USA

Re: Expanding a Flex Tree

Post by Jonathan » Mon Nov 15, 2010 5:12 pm

The location of the triangle changes within the rectangle of the element, since the rectangle of the element doesn't change with an increase in depth in the tree, but the location of the triangle inside it does, this means that any method I make that uses the pixel location expected for the triangle has to calculate what that is based on the elements depth. This wouldn't be much of an issue except that I am trying to build something that can select and expand an element of the tree without having to know this information in advance, since the depth of the element can change based on things the user has done elsewhere.

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Expanding a Flex Tree

Post by artur_gadomski » Tue Nov 16, 2010 8:22 am

I didn't work with image based recognition yet so this might not work:
Maybe it would be possible to use image recognition to find a triangle within each items rectangle?