Board index » delphi » TreeView - making a node "selected"

TreeView - making a node "selected"

Folks,

This is rather annoying and probably totally stupid, but how on earth
can I make a treeview node (FMyNode: TTreeNode) the selected node, and
make sure it really visually appears to be so??

I tried to make my node the selected node, and the focused node

        FMyNode.Selected := True;
        FMyNode.Focused := True;

but no matter how hard I try, the TreeView never displays it as
selected - you know, with the blue background and all. Nothing - nada.

Is there a way to trick the treeview into actually *displaying* my
selected node as if I had clicked on it with the mouse?

Thanks!
Marc

------------------------------------------------------------------------
Marc Scheuner                                          Software Engineer
Quest Software Canada                       Halifax, Nova Scotia, Canada
Email: marc.scheu...@quest.com                      http://www.quest.com

 

Re:TreeView - making a node "selected"


Quote
> I tried to make my node the selected node, and the focused node

> FMyNode.Selected := True;
> FMyNode.Focused := True;

> but no matter how hard I try, the TreeView never displays it as
> selected - you know, with the blue background and all. Nothing -

nada.

Does the TreeView have the focus? Maybe you forgot to set
HideSelection to False?

Quote
> Is there a way to trick the treeview into actually *displaying* my
> selected node as if I had clicked on it with the mouse?

Look at TTreeNode.MakeVisible.

Re:TreeView - making a node "selected"


I'm not a 100% sure but I'm going to guess TTreeNode.Selected is used for
MultiSelect TreeViews. I'm guessing your going to want TreeView.Selected :=
FMyNode

Thanks
Wayne

Quote
"Marc Scheuner" <mscheu...@no.spam.for.me.ca> wrote in message

news:3vov5ukukgkpl87hp59rbn3v8scklqghtn@4ax.com...
Quote
> Folks,

> This is rather annoying and probably totally stupid, but how on earth
> can I make a treeview node (FMyNode: TTreeNode) the selected node, and
> make sure it really visually appears to be so??

> I tried to make my node the selected node, and the focused node

> FMyNode.Selected := True;
> FMyNode.Focused := True;

> but no matter how hard I try, the TreeView never displays it as
> selected - you know, with the blue background and all. Nothing - nada.

> Is there a way to trick the treeview into actually *displaying* my
> selected node as if I had clicked on it with the mouse?

> Thanks!
> Marc

> ------------------------------------------------------------------------
> Marc Scheuner                                          Software Engineer
> Quest Software Canada                       Halifax, Nova Scotia, Canada
> Email: marc.scheu...@quest.com                      http://www.quest.com

Re:TreeView - making a node "selected"


On Tue, 5 Feb 2002 16:16:11 -0500, "Wayne"

Quote
<mewayne.NO.S...@hotmail.com> wrote:
>I'm not a 100% sure but I'm going to guess TTreeNode.Selected is used for
>MultiSelect TreeViews. I'm guessing your going to want TreeView.Selected :=
>FMyNode

I had tried that, too, same result.

Marc

------------------------------------------------------------------------
Marc Scheuner                                          Software Engineer
Quest Software Canada                       Halifax, Nova Scotia, Canada
Email: marc.scheu...@quest.com                      http://www.quest.com

Re:TreeView - making a node "selected"


On Tue, 5 Feb 2002 16:25:48 +0200, "Constantine Yannakopoulos"

Quote
<k...@singular.gr> wrote:
>> I tried to make my node the selected node, and the focused node
>> FMyNode.Selected := True;
>> FMyNode.Focused := True;

>Does the TreeView have the focus? Maybe you forgot to set
>HideSelection to False?

Yup, silly as it is - these were the problems - thanks a heap! Works
like a charm now.

Marc

------------------------------------------------------------------------
Marc Scheuner                                          Software Engineer
Quest Software Canada                       Halifax, Nova Scotia, Canada
Email: marc.scheu...@quest.com                      http://www.quest.com

Other Threads