From: Nikolaus Kern on
Hello all,

I am using a treeview object to show a list of datarecords - similiar to
a windows explorer windows for directories and files.

The loading etc. works fine.

I wonder now if there is a chance to search in the values of the Treeview:

e.g. oTreeView:Find("whatever")

At this point in time I see following options:
1) create an ACCESS to the protected array aValues or aTreeItems of the
Treeview object
2) Overload the oTV:AddItem() method and register every item in an array
and expose it via an ACCESS to the dataform for searching.

Any expirence arround searching in treeviews?

Thanks

VO 2.8 SP3-2837

Niko
From: E®!k /!sser on
Niko,
Have a look at the SDK. The TV control already has an aTreeItems and a
aValues array.
You should be able to write a method to search into these..

Erik

"Nikolaus Kern" <parzival1969(a)gmx.at> schreef in bericht
news:a1102$4b781a26$506d237b$22627(a)news.chello.at...
> Hello all,
>
> I am using a treeview object to show a list of datarecords - similiar to a
> windows explorer windows for directories and files.
>
> The loading etc. works fine.
>
> I wonder now if there is a chance to search in the values of the Treeview:
>
> e.g. oTreeView:Find("whatever")
>
> At this point in time I see following options:
> 1) create an ACCESS to the protected array aValues or aTreeItems of the
> Treeview object
> 2) Overload the oTV:AddItem() method and register every item in an array
> and expose it via an ACCESS to the dataform for searching.
>
> Any expirence arround searching in treeviews?
>
> Thanks
>
> VO 2.8 SP3-2837
>
> Niko

From: Geoff Schaller on
Niko.

It is just like Erik said. The treeview is an array (two in fact) so
there is no need to create another array over the top. VO manages this
by maintaining an array of TreviewItems which gives you an object
oriented access to all the items and an array of values. You could walk
the tree easily enough using existing methods but if you wanted a "find"
on the label or the value, it is a simple enough process to just do an
array scan on the items array. Something like:

dwPosn := Ascan(aTreeItems, {|o| o:textValue == cSearch})
oTreeviewItem := aTreeItems[dwposn]

But equally, the class maintains an aValues array which holds a
reference to NameSym and the Value. Take a look at the SDK and look up
InsertItem() of the treeview class.

dwPosn := AScan(aValues, {|o| o[2] = uValue})
symName := aValues[dwPosn, 1]
oTreeviewItem := oTreeView:SelectItem(symName) ... or something

Geoff




"Nikolaus Kern" <parzival1969(a)gmx.at> wrote in message
news:a1102$4b781a26$506d237b$22627(a)news.chello.at:

> Hello all,
>
> I am using a treeview object to show a list of datarecords - similiar to
> a windows explorer windows for directories and files.
>
> The loading etc. works fine.
>
> I wonder now if there is a chance to search in the values of the Treeview:
>
> e.g. oTreeView:Find("whatever")
>
> At this point in time I see following options:
> 1) create an ACCESS to the protected array aValues or aTreeItems of the
> Treeview object
> 2) Overload the oTV:AddItem() method and register every item in an array
> and expose it via an ACCESS to the dataform for searching.
>
> Any expirence arround searching in treeviews?
>
> Thanks
>
> VO 2.8 SP3-2837
>
> Niko

From: Nikolaus Kern on
Erik, Goeff,

Thanks for the input.

It works fine.

Niko