Re: Popup Hints in Treeview
From: Maarten Wiltink (maarten_at_kittensandcats.net)
Date: 10/07/04
- Next message: Jud McCranie: "Re: Question about Delphi versus other languages"
- Previous message: Maarten Wiltink: "Re: nmnntp"
- In reply to: AlanGLLoyd: "Re: Popup Hints in Treeview"
- Next in thread: Bruce Roberts: "Re: Popup Hints in Treeview"
- Reply: Bruce Roberts: "Re: Popup Hints in Treeview"
- Reply: AlanGLLoyd: "Re: Popup Hints in Treeview"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 7 Oct 2004 16:08:54 +0200
"AlanGLLoyd" <alanglloyd@aol.com> wrote in message
news:20041007060705.24105.00000864@mb-m12.aol.com...
> In article <chc82t$rsj$1@newsreader2.netcologne.de>, Peter Sprenger
> <sprenger@moving-bytes.de> writes:
>> I want to give every item in a treeview a different popup hint.
>
> You have to turn the TreeView.ShowHints off and generate and display
> your own hint window in the TreeView OnMouseMove event handler ...
I do?
<snip very horrible handler>
I did this instead:
event TTreeView.OnMouseMove;
var
TreeView: TTreeView;
CurrentNode: TTreeNode;
begin
if (Sender is TTreeView)
then TreeView:=Sender as TTreeView
else Exit;
CurrentNode:=TreeView.GetNodeAt(X, Y);
if (Assigned(CurrentNode) and (X<TreeView.Indent*CurrentNode.Level))
then CurrentNode:=nil;
if not (HoverNode=CurrentNode)
then begin
HoverNode:=CurrentNode;
Application.CancelHint;
TreeView.Hint:=ComputeHint(HoverNode);
end;
end;
Required but not shown are a form field (HoverNode) to keep track of
the node the mouse is (or last was) over, and a function (ComputeHint)
that turns a treenode into the desired hint string. The function can
be written out in-line, of course.
With many thanks to Bruce, who posted the bit about CancelHint at just
the right time to make me look good at work.
Note that the bit about Indent and Level is not required; it just
inhibits hint display when the mouse is visually left of the node
proper.
Groetjes,
Maarten Wiltink
- Next message: Jud McCranie: "Re: Question about Delphi versus other languages"
- Previous message: Maarten Wiltink: "Re: nmnntp"
- In reply to: AlanGLLoyd: "Re: Popup Hints in Treeview"
- Next in thread: Bruce Roberts: "Re: Popup Hints in Treeview"
- Reply: Bruce Roberts: "Re: Popup Hints in Treeview"
- Reply: AlanGLLoyd: "Re: Popup Hints in Treeview"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|