Forum Discussion

ChrisMac's avatar
ChrisMac
Contributor
13 years ago

TreeView checkbox - checked/unchecked state

Hi All -

I've got a PhaseTreeView class where I'm trying to determine if an item (branch) in that tree (which has a checkbox associated with it) is checked or unchecked. The object spy gives me this:



phaseTreeView.wItems.Item(0).Checked



But the Checked property had a red "X" icon and the following text where the value would be:



Error: Error

The tree nodes have no check boxes.

The TVS_CHECKBOXES window style is not set.



So how do I set the TVS_CHECKBOXES window style? Or is this property simply not available to me?



I've tried other properties like:

Item(0).Checked



but they aren't giving me the correct value.



Chris



  • ASV's avatar
    ASV
    Contributor
    Hi Chris

    There are two properties cbchecked and cbunchecked if you want to click ckeckbox and you don't know it is checked write in this way



    VBObject("checkbox").clickbutton(cbchecked),



    Otherwise-



    VBObject("checkbox").clickbutton(cbunchecked)
  • Hi Vahagn, thanks for the reply. I'm a little confused....ClickButton is not a method associated with a phaseTreeView class. I can only use ClickItem. I can record clicking the checkbox in the tree and get:


    Call phaseTreeView.ClickItem("|FIXTURES") 


    In any case I have no problem clicking the checkbox, it's determining the correct state, checked or unchecked, that I'm having trouble with.

  • AlexeyKryuchkov's avatar
    AlexeyKryuchkov
    SmartBear Alumni (Retired)
    Hi Chris,



    It sounds as if your control added check boxes independently of the window style. Thus, TestComplete doesn't know the correct way to check the state of check boxes, and the Checked property throws the error. I tried to google anything about the "PhaseTreeView" control to find a way to accomplish your task, but failed. Can you give us an example of the problematic control or let us know where we can get it? Otherwise, the only help I can offer is trying the approaches listed in the "Ways to Interact With Application Objects" help topic.



    If you want to get personalized assistance, let us continue working on the issue within the support case you submitted.
  • Hi Mike-

    I've finally found the right combination of objects and methods:



    Dim bIsChecked

    bIsChecked=This.phaseTreeView.Item(0).GetChecked



    This will return TRUE or FALSE depending on whether the a TreeView branch is checked or not.



    Hopefully this will be of some help to anyone else who is working with the phaseTreeView class. You can close my issue.



    Chris