Board index » delphi » Tree View - How to highlight a Tree View node with coding

Tree View - How to highlight a Tree View node with coding

Can anyone tell me how to highlight a tree view node with coding?

Thanks a lot!
Charlie Zhang
--
czh...@dataworks.com

 

Re:Tree View - How to highlight a Tree View node with coding


Simply use the Selected property:

    MyTreeview.Selected := NodeIWantToHightLight;

If you wish to simply highlight it without actually selecting it, use
DropTarget property (altough there's some known problems with using that
one)

D. Filion

Charlie Zhang a crit dans le message
<01bd7ed0$bb9d7dc0$31480...@ctabor.DataWorks.com>...

Quote
>Can anyone tell me how to highlight a tree view node with coding?

>Thanks a lot!
>Charlie Zhang
>--
>czh...@dataworks.com

Re:Tree View - How to highlight a Tree View node with coding


Hi D. Filion:

The code, MyTreeview.Selected := NodeIWantToHightLight, only can move to
the node. but it did not really lightlight the node. Could you please tell
me how to do hightlight.

Thanks
Charlie Zhang
--
czh...@dataworks.com

D. Filion <dfilion@(anti-spam insert)globetete.com> wrote in article
<6jdr20$d...@forums.borland.com>...

Quote
> Simply use the Selected property:

>     MyTreeview.Selected := NodeIWantToHightLight;

> If you wish to simply highlight it without actually selecting it, use
> DropTarget property (altough there's some known problems with using that
> one)

> D. Filion

> Charlie Zhang a crit dans le message
> <01bd7ed0$bb9d7dc0$31480...@ctabor.DataWorks.com>...
> >Can anyone tell me how to highlight a tree view node with coding?

> >Thanks a lot!
> >Charlie Zhang
> >--
> >czh...@dataworks.com

Re:Tree View - How to highlight a Tree View node with coding


Hi Charlie,

maybe you didn't focus the Tree!
Two solutions:

1.)     MyTreeview.SetFocus;
         MyTreeview.Selected := NodeIWantToHighlight;

2.)    MyTreeview.HideSelection := FALSE;

when 2.), then the selected node is alway highlighted, even if you switch the
focus to another control (if so, then the highlight is gray instead of blue)

cu

Boris Nienke

Quote
Charlie Zhang wrote:
> Hi D. Filion:

> The code, MyTreeview.Selected := NodeIWantToHightLight, only can move to
> the node. but it did not really lightlight the node. Could you please tell
> me how to do hightlight.

> Thanks
> Charlie Zhang
> --
> czh...@dataworks.com

> D. Filion <dfilion@(anti-spam insert)globetete.com> wrote in article
> <6jdr20$d...@forums.borland.com>...
> > Simply use the Selected property:

> >     MyTreeview.Selected := NodeIWantToHightLight;

> > If you wish to simply highlight it without actually selecting it, use
> > DropTarget property (altough there's some known problems with using that
> > one)

> > D. Filion

> > Charlie Zhang a crit dans le message
> > <01bd7ed0$bb9d7dc0$31480...@ctabor.DataWorks.com>...
> > >Can anyone tell me how to highlight a tree view node with coding?

> > >Thanks a lot!
> > >Charlie Zhang
> > >--
> > >czh...@dataworks.com

Other Threads