Find an item in a TreeView

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Find an item in a TreeView

Rolf-Werner Eilert
Hi folks,

there is a TreeView in a dialog in my application that lets the user
pick a printing form.

When the user calls the dialog a second time, I would like to have it
expanded and marked at the previous position, so the user would not have
to search the form again.

The dialog saves the paths to the printing forms as keys in the
TreeView, so they are unique and would give a good starting point for this.

But I cannot make out where to put a key string (or whatever) to make
the TreeView expand the branch and mark the item.

There is "find", but it takes X/Y coordinates, and it reports Boolean
only. So, can someone help?

Thanks in advance.

Rolf



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

RE: Find an item in a TreeView

nigel-4

Eilert,

Try using

TreeView.MoveTo(key)

TreeView.Item.Selected = TRUE

TreeView.Item.Expanded = TRUE

regards

Nigel



> Message Received: Sep 21 2005, 08:58 AM

> From: "Eilert"
> To: [hidden email]
> Cc:
> Subject: [Gambas-user] Find an item in a TreeView
>
> Hi folks,
>
> there is a TreeView in a dialog in my application that lets the user
> pick a printing form.
>
> When the user calls the dialog a second time, I would like to have it
> expanded and marked at the previous position, so the user would not have
> to search the form again.
>
> The dialog saves the paths to the printing forms as keys in the
> TreeView, so they are unique and would give a good starting point for this.
>
> But I cannot make out where to put a key string (or whatever) to make
> the TreeView expand the branch and mark the item.
>
> There is "find", but it takes X/Y coordinates, and it reports Boolean
> only. So, can someone help?
>
> Thanks in advance.
>
> Rolf
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server.
> Download it for free - -and be entered to win a 42" plasma tv or your very
> own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Find an item in a TreeView

Rolf-Werner Eilert
Hi Nigel,

thanks for your tip. It works, but

> TreeView.MoveTo(key)
>
> TreeView.Item.Selected = TRUE
>
> TreeView.Item.Expanded = TRUE

instead of .Expanded I had to use .EnsureVisible to make the entry show up.


Regards
Rolf



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user