John_Laird
9 years agoContributor
trouble accessing treeview item count property
So I have this Python code and I am trying to get the item count of a System.Windows.Forms.TreeView:
def miscdriver(): editMultQueryDialog = Aliases.ACMConfig.FormCustomPropertyQuery if editMultQueryDialog.treeView1.Enabled is False: editMultQueryDialog.toolStrip1.ClickItem("Add") else: #deselect all nodes at root level tree = editMultQueryDialog.treeView1 treeitems = tree.wItems #this is line 897 treeitemcount = treeitems.Count for itemindex in range(0, treeitemcount): if editMultQueryDialog.treeView1.wItems.Item[itemindex].Checked is True: editMultQueryDialog.treeView1.wItems.Item[itemindex].Check(cbUnchecked)
TC12 consistently throws this error on the line 'tree.wItems':
AttributeError The object does not support this property or method. Error location: Unit: "ACM_EvalTests\ACM\Script\ConfigureObjectHelper" Line: 897 Column: 1.
AttributeError
The object does not support this property or method.
Error location:
Unit: "ACM_EvalTests\ACM\Script\ConfigureObjectHelper"
Line: 897 Column: 1.
The object does not support this property or method.
Error location:
Unit: "ACM_EvalTests\ACM\Script\ConfigureObjectHelper"
Line: 897 Column: 1.
If I go into Object Spy I can select the treeview and drill down into the item count property with no issue:
Aliases.ACMConfig.FormCustomPropertyQuery.WinFormsObject("treeView1").wItems.Count
Suggestions on resolving this?