Forum Discussion

axid's avatar
axid
New Contributor
15 years ago

wait for SysTreeView32 item to appear

Hello,



Is there any way to wait for SysTreeView32 node to appear without getting an error...?

SysTreeView32 items do not have Exists property



WaitWindow or WaitChild are not working...



thanks

:)

4 Replies

  • axid's avatar
    axid
    New Contributor




    Aliases.Dialog_ThingsViewer.WaitWindow("SysTreeView32","Tree1",1,10000)

    this works only for waiting for the tree



    if i want to access items in the tree i can do it like this:

    Aliases.Dialog_ThingsViewer.tree_BigThings.wItems.Item(item_name_or_index)

    this return Item object (Win32TreeViewItem) that has no Exists property, so i cant test whether it already exist or not

    the same way wItem that returns a Collection Object (TreeViewItemCollection) of items that has no property or method to check whether it has some item or not...



    tree_BigThings is the mapped name for ("SysTreeView32","Tree1",1) in Dialog_ThingsViewer




    am I missing something?
  • Hi,



    If you want to check whether an item exists in the tree, you need to search for it within the tree items by iterating through them and comparing their captions with the needed one. The tree items do not have the Exists property since they're internal objects of a control, and they're not shown in the object tree.

  • axid's avatar
    axid
    New Contributor
    Yep, i thought about searching. However it may be very slow sometimes and require extra loop. I hoped that there were some more compact ways to do that.



    Maybe there is a way to convert TreeViewItemCollection into string and then use some string lookup method. I'm not sure if it is a faster way though.