BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Node Color

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
mARCELO
Guest





PostPosted: Mon Jul 28, 2003 9:38 pm    Post subject: Node Color Reply with quote



how can i change the color of a node on a TreeView?

Marcelo

--


Back to top
Mark Williams
Guest





PostPosted: Tue Jul 29, 2003 9:33 am    Post subject: Re: Node Color Reply with quote



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





PostPosted: Tue Jul 29, 2003 12:50 pm    Post subject: Re: Node Color Reply with 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

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





PostPosted: Tue Jul 29, 2003 12:59 pm    Post subject: Re: Node Color Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.