 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
mARCELO Guest
|
Posted: Mon Jul 28, 2003 9:38 pm Post subject: Node Color |
|
|
how can i change the color of a node on a TreeView?
Marcelo
--
|
|
| Back to top |
|
 |
Mark Williams Guest
|
Posted: Tue Jul 29, 2003 9:33 am Post subject: Re: Node Color |
|
|
Marcelo,
Use the TTreeView.OnCustomDrawItem event. Draw your own items for those
that need colour and otherwise set defaultdraw variable of the event to
true.
There are 3rd party alternatives that handle this sort of stuff for you,
such as virtual treeview http://www.lischke-online.de, which I haven't used,
but seems to get good write ups in the newsgroups. It's also free!
Regards,
Mark
"mARCELO" <lombi2000 (AT) yahoo (DOT) com> wrote
| Quote: | how can i change the color of a node on a TreeView?
Marcelo
--
|
|
|
| Back to top |
|
 |
Mark Williams Guest
|
Posted: Tue Jul 29, 2003 12:50 pm Post subject: Re: Node Color |
|
|
Marcelo,
Something like this should work:
procedure TForm1.TreeView1CustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
if node.hasChildren then
with Treeview1.Canvas do
Font.style:=[fsBold];
DefaultDraw:=true;
end;
Untested!
Regards,
Mark
"mARCELO" <lombi2000 (AT) yahoo (DOT) com> wrote
| Quote: | Mark,
before use the TTreeView.OnCustomDrawItem event, i used to change the
property bold of a node by using a specific function (every node who had
childs i set the bold to true).
now, using the event, the color was changed, but my bold nodes, they are
all
wrong, confused.
What happened?
"Mark Williams" <m.williams77 (AT) ntlworld (DOT) com> escreveu na mensagem
news:3f263ef7$1 (AT) newsgroups (DOT) borland.com...
Marcelo,
Use the TTreeView.OnCustomDrawItem event. Draw your own items for those
that need colour and otherwise set defaultdraw variable of the event to
true.
There are 3rd party alternatives that handle this sort of stuff for you,
such as virtual treeview http://www.lischke-online.de, which I haven't
used,
but seems to get good write ups in the newsgroups. It's also free!
Regards,
Mark
"mARCELO" <lombi2000 (AT) yahoo (DOT) com> wrote in message
news:3f259811 (AT) newsgroups (DOT) borland.com...
how can i change the color of a node on a TreeView?
Marcelo
--
|
|
|
| Back to top |
|
 |
mARCELO Guest
|
Posted: Tue Jul 29, 2003 12:59 pm Post subject: Re: Node Color |
|
|
still not working...
every node of the tree is created at run-time....
what i really want, is something like the function i use to set the node
bolded.
procedure SetNodeBoldState(Node: TTreeNode;Value: Boolean);
var TVItem : TTVItem;
begin
if not Assigned(Node) then Exit;
with TVItem do
begin
mask := TVIF_STATE or TVIF_HANDLE;
hitem := Node.ItemId;
stateMask := TVIS_BOLD;
if Value then state := TVIS_BOLD
else
state := 0;
TreeView_SetItem(Node.Handle,TVItem);
end;
end;
wich one is called outside the OnCustomDrawItem event.
Marcelo
"Mark Williams" <m.williams77 (AT) ntlworld (DOT) com> escreveu na mensagem
news:3f266d27$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Marcelo,
Something like this should work:
procedure TForm1.TreeView1CustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
if node.hasChildren then
with Treeview1.Canvas do
Font.style:=[fsBold];
DefaultDraw:=true;
end;
Untested!
Regards,
Mark
"mARCELO" <lombi2000 (AT) yahoo (DOT) com> wrote in message
news:3f26569e$1 (AT) newsgroups (DOT) borland.com...
Mark,
before use the TTreeView.OnCustomDrawItem event, i used to change the
property bold of a node by using a specific function (every node who had
childs i set the bold to true).
now, using the event, the color was changed, but my bold nodes, they are
all
wrong, confused.
What happened?
"Mark Williams" <m.williams77 (AT) ntlworld (DOT) com> escreveu na mensagem
news:3f263ef7$1 (AT) newsgroups (DOT) borland.com...
Marcelo,
Use the TTreeView.OnCustomDrawItem event. Draw your own items for
those
that need colour and otherwise set defaultdraw variable of the event
to
true.
There are 3rd party alternatives that handle this sort of stuff for
you,
such as virtual treeview http://www.lischke-online.de, which I haven't
used,
but seems to get good write ups in the newsgroups. It's also free!
Regards,
Mark
"mARCELO" <lombi2000 (AT) yahoo (DOT) com> wrote in message
news:3f259811 (AT) newsgroups (DOT) borland.com...
how can i change the color of a node on a TreeView?
Marcelo
--
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|