Ranorex

ElementDoDefaultAction on a TreeView heading

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexPython
View previous topic :: View next topic  
Author Message
Mike



Joined: 15 Aug 2007
Posts: 7
Location: Seattle

PostPosted: Mon Nov 05, 2007 7:48 pm    Post subject: ElementDoDefaultAction on a TreeView heading
Hi,

I have a winXP SP2 box. In the app I'm testing I have a SysTreeView32 control that contains a number of elements. The default action on these elements is Expand. I'm trying to expand the element by using ElementDoDefaultAction.
Code: click into code to enlarge
element = Ranorex.ControlGetElement(control)
      treeViewHeading = Ranorex.ElementFindChild(element, 36, heading, "SysTreeView32")
      position=Ranorex.ElementGetPosition(treeViewHeading)
      if element != None:


          print "Found the tree view control"
      else:
          print "Can't find tree view control"
   
          return -3
     
      if (position != None and position[0] != 0 and position[1] != 0):

          #Works
          Ranorex.MouseMoveToElement(treeViewHeading)
          #Works
          Ranorex.MouseClickElement(treeViewHeading)
          #Fails
          Ranorex.ElementDoDefaultAction(treeViewHeading)

I can move the mouse to the element using this code and I can click on the element using this code but when I try and expand the element it silently fails. How can I expand the treeview elements?

Thanks,
Mike
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 344

PostPosted: Mon Nov 05, 2007 11:03 pm    Post subject:
Please read the topic:

http://www.ranorex.com/forum/locating-a-folder-in-treeview-t95.html

behdad made the following (C# code):

Code: click into code to enlarge
protected void TreeNodeExpand(Element folder)
{
  // Check to see if the node is collapsed then expand it
  if ((folder.State & State.Collapsed) != 0)
  {
    // Double click the folder
    ElementDoubleClick(folder);

    // Wait for it to get expanded
    while ((folder.State & State.Collapsed) != 0)
    {
      // Wait
      Wait(Constants.TIMEOUT_TINY);
    }
  }
}


Jenö
Ranorex Support Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexPython All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum