Thanks.

Got a bit confused by the text in the Reference Manual.

My idea is to "read" or retrieve the whole information from the tree structure itself. That is the full set of text (labels) for the entries of the tree. My sub was just set up, to at least get in touch with the treeview.

Am I on the right track, when asuming that I will have to retrieve a TreeviewItem from each entry in the TreeViewItems list, and then go from there? And will I have to "manually" let the app expand every branch of the treeview, or is there a more direct way of getting to the individual labels?

Hope my questions make sense. So, I am not trying to construct a treeview, but to retrieve information from an already existing treeview, for further handling.

Thanks again,

----- Original Message ----- From: "Stephen Clower" <[email protected]>
To: <[email protected]>
Sent: Monday, August 13, 2012 2:09 PM
Subject: Re: TreeView - please help


David,

Are you wanting to obtain all tree view items? If so, try this:

Sub TheTreeview()
Dim Win: Set Win = FocusedWindow
If Win.Type <>WtTreeView Then Exit Sub
' Apparently we are in a TreeView:
Speak Win.Type
Speak "You are now in a treeview."
Dim TView: Set TView = Win.Control ' Note that this gives you the treeview control directly. You do not need to explicitly request a tree view.

' TreeViewItems was never defined, so I assume you meant to get the number of items in the tree's top level. In that case:
speak TView.TopLevel.Count
End Sub 'TheTreeview.

Regards,
Steve





On 8/12/2012 8:16 PM, David wrote:
I have the following sub:

Sub TheTreeview()
  Dim Win: Set Win = FocusedWindow
  If Win.Type <>WtTreeView Then Exit Sub

' Apparently we are in a TreeView:
  Speak Win.Type
  Speak "You are now in a treeview."

  Dim Ctrl: Set Ctrl = Win.Control
  Dim TView: Set TView = Ctrl.TreeView

  speak TreeViewItems.Count
End Sub 'TheTreeview.

I can place my cursor on anything else but a treview, and the sub will simply exit. So far, things are alright.

When I put my cursor on a treview, and run this sub, it sure speaks two lines of info:
     22
     You are now in a treeview.
Just what I expected it to.

But then it throws an error on me:
     Object doesn't support this property or method: 'Ctrl.TreeView'

A bit confused. Likely I am missing something, but can't figure exactly what. In the documentation of WE, it states under TreeView:
Usage
Use a
TreeView
  object to retrieve information regarding a tree view control. A
TreeView
  object can be obtained from a
Window
  object's
Control
  method when the
Window
  object's
Type
  is
wtTreeView


In my sub, I set an object (Win) from the FocusedWindow. Then another object (Ctrl) from that Window object's Control. Isn't that what the documentation claims to be the way to go? And from here, I should have been able to retrieve the TreeView object. What am I missing?

Thanks for any guidance.



--
Stephen Clower
Product support specialist & App Development
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com



Reply via email to