Author: Tomas Rutkauskas
I want to display a hint on a TTreeView which varies from node to node. So I get
the node over which the mouse is in the MouseMove event and change the Hint
property of the TreeView.
Answer:
Our ElTree has own hints for every item and we did the following:
1 { ... }2 if (FHintItemEx <> nil) or (not ShowHint) then3 begin4 Application.Hint := FOwner.FRealHint;
5 Hint := FOwner.FRealHint;
6 TSI := GetItemAt(message.XPos, message.YPos, IP, HCol);
7 if (TSI <> nil) then8 begin9 if (FHintItemEx <> TSI) then10 begin11 if Length(TSI.Hint) > 0 then12 begin13 Application.Hint := TSI.Hint;
14 Hint := TSI.Hint;
15 end;
16 if ShowHint and (not FInDragging) then17 begin18 P := ClientToScreen(SmallPointToPoint(message.Pos));
19 {$IFDEF VCL_5_USED}20 Application.ActivateHint(P);
21 {$ELSE}22 MoveMemory(@AMsg, @message, sizeof(AMsg));
23 TWMMouse(AMsg).XPos := -10000;
24 TWMMouse(AMsg).YPos := -10000;
25 Application.HintMouseMessage(Self, AMsg);
26 TWMMouse(AMsg).Pos := message.Pos;
27 Application.HintMouseMessage(Self, AMsg);
28 {$ENDIF}29 end;
30 end;
31 end;
32 end;
33 { ... }