SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Jan 2002
    Location
    Houston, TX, USA
    Posts
    120
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Tree count always returns 1.

    We're evaluating TestComplete for our 64-bit Windows application.

    For some reason, trees on any form always seem to return 1 as the count. My code is as follows:

    <font class="small">Code:</font><hr /><pre>
    Sub TreeTest_Count(strWindowCaption, strTreeItem)
    Dim wTree
    Set wTree = Sys.Process( _
    "TKS"). _
    Window("Afx:*", "*"). _
    Window("MDIClient"). _
    Window("Afx:*", strWindowCaption &amp; "*"). _
    Window("Afx:*"). _
    Window("AfxFrameOrView80"). _
    Window("SysTreeView32", "", 2)

    call wtree.ExpandItem(strTreeItem)

    log.Message( "There's " &amp; wTree.wRootItemCount &amp; " item(s) in the tree.")

    End Sub
    </pre><hr />
    I have no other problems with tree controls. Using very similar code, I can click them, expand, collapse, etc. Only the count seems to fail.

    I'm sorry if this is a stupid question. In my defense, I've only been using this tool since last Wednesday.

    Thanks in advance for any help you can give,
    Ian

  2. #2
    Moderator tristaanogre's Avatar
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA
    Posts
    1,792
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Tree count always returns 1.

    Note that the property you are referencing is RootItemCount. That mean that, in that tree, how many root items are there? If you only have a single root item in your tree, then your code is working correctly.
    -Robert Martin
    Automated Testing Evangelists
    TestComplete "expert"
    Definition expert - noun - Unknown drip under pressure

  3. #3
    Senior Member
    Join Date
    Mar 2007
    Location
    Waterloo, Ontario, Canada
    Posts
    3,628
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Tree count always returns 1.

    Yeah, Robert's right. You've probably got Desktop at your root so it only sees that item. The property you want to use instead is wItemCount. This counts the subitems of the currently-selected branch.

    Just make sure to click on the item you're expanding or make sure it's selected when you run the wItemCount or you'll get the subitems of the parent, not the one you expanded.
    Brent
    --------------------
    9 out of 10 people I prove wrong agree that I'm right. The other person is my wife.
    --------------------

  4. #4
    Senior Member
    Join Date
    Jan 2002
    Location
    Houston, TX, USA
    Posts
    120
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: Tree count always returns 1.

    Thanks guys. You're right. I'm now able to get an accurate count.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 01:34 AM.

Copyright BetaSoft Inc.