The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:




Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> Micro Focus/Compuware TestPartner

Pages: 1
jbottiger
Member


Reged: 10/28/11
Posts: 66
Loc: FL
Checking if Children Exist for a TreeView Node
      #715705 - 08/31/12 03:50 PM

I have a DotNETTreeView that may or may not contain children of a specific node. How do I check to see if any children exist?

My code looks like this:

Private Sub Check_Data_Avail(strProjectName As String)

Dim ProjectView As TDotNETTreeView, DataFiles As TChildren, DataExists As Boolean, NumDataFiles As Long

Call shmdl_Get_GStation_Ready("DotNetForm", "GStation_Main", "G-Station ready for processing", "G-Station still not ready yet")

Set ProjectView = DotNETTreeView("GStation_ProjectView")

ProjectView.Attach

ProjectView.SelectItem "\Project: " & strProjectName & "\Data"

DataExists = ProjectView.TextExists("Data")

Set DataFiles = ProjectView.Children

NumDataFiles = DataFiles.Count

MsgBox "Number of DataFiles is " & NumDataFiles

MsgBox "Data Exists?" & DataExists

Pause 5

End Sub


The screenshot below shows that I do have data files, but the number of data files according to TestPartner is incorrect. What part of my script should be changed to provide an accurate count? How do I count the number of children from the Data node and not the root node (Project)? Any help you can provide would be greatly appreciated. Thanks.

--------------------
V/R,
John J. Bottiger


Post Extras: Print Post   Remind Me!   Notify Moderator  
amodio
Newbie


Reged: 08/22/12
Posts: 12
Re: Checking if Children Exist for a TreeView Node [Re: jbottiger]
      #715753 - 09/03/12 01:19 AM

hi
you need just do a FOR in a items

there is a thread about it
you can find a solution here
http://www.sqaforums.com/showflat.php?Cat=0&Number=715457&an=0&page=0#Post715457

--------------------
i am a troll
do not take so seriously my posts


Post Extras: Print Post   Remind Me!   Notify Moderator  
jbottiger
Member


Reged: 10/28/11
Posts: 66
Loc: FL
Re: Checking if Children Exist for a TreeView Node [Re: amodio]
      #715848 - 09/04/12 02:01 PM

amodio,

I changed my script to read as follows:

Private Sub Check_Data_Avail(strProjectName As String)

Dim ProjectView As TDotNETTreeView, DataFiles As TChildren, DataFiles1 As TItems, DataExists As Boolean, NumDataFiles As Long, NumDataFiles1 As Long

Call shmdl_Get_GStation_Ready("DotNetForm", "GStation_Main", "G-Station ready for processing", "G-Station still not ready yet")
Set ProjectView = DotNETTreeView("Parent.Caption=Data")
ProjectView.Attach
DataExists = ProjectView.TextExists("Data")
Set DataFiles = ProjectView.Children
Set DataFiles1 = ProjectView.Items
NumDataFiles = DataFiles.Count
NumDataFiles1 = DataFiles1.Count
MsgBox "Number of DataFiles is " & NumDataFiles1
MsgBox "Data Exists?" & DataExists
Pause 5
End Sub

I set up my screen such that the "Data" node has no children nodes at all. What I'm trying to do is count the number of nodes under the "Data" node, which should be 0. However, the results are as follows:

NumDataFiles (using Children property) = 0 (correct)
NumDataFiles1 (using Items property) = 14 (incorrect)

When I add one data node, the number of nodes under "Data" should be 1, which contains 2 sub-nodes, each containing 51 and 2 subnodes, respectively (total of 56 items under "Data"). This time, the results are as follows:

NumDataFiles (using Children property) = 0 (incorrect)
NumDataFiles1 (using Items property) = 70 (incorrect)

Please advise as to what should be changed in my script and/or what I'm doing wrong. Apparently, it is not doing what it should be doing according to your article.

Did you count the items under the top of the tree view or just from a subnode that has children?

Thanks.

--------------------
V/R,
John J. Bottiger


Post Extras: Print Post   Remind Me!   Notify Moderator  
amodio
Newbie


Reged: 08/22/12
Posts: 12
Re: Checking if Children Exist for a TreeView Node [Re: jbottiger]
      #715866 - 09/05/12 12:25 AM

Quote:


Did you count the items under the top of the tree view or just from a subnode that has children?




sorry man
i am using testPartner with a non .net application,
so, i am unable to count children subnodes

and i cannot test it for helping you because i do not have any .net treeview to try

hope someonelse can help you

--------------------
i am a troll
do not take so seriously my posts


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 4 anonymous users are browsing this forum.

Moderator:  Myrtle, Jim Brennan, AJ, DSquared 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 2444

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5