Reputation: 4624
I need to create a custom hint window (with it's own color and layout) for a specific control (not the entire application)
The hint text itself will not be connected to that specific Hint
property control.
As suggested I wrote a handler for CM_HINTSHOW
(This worked if the Control has ShowHint=True
):
procedure TMyControl.CMHintShow(var Message: TMessage);
begin
Form1.caption := 'x';
// Here I will display my own Hint window
// inherited;
end;
But now, how do I know when/where to hide it when the hint times out? neither CM_HINTSHOW
or CM_HINTSHOWPAUSE
gives me this info.
Upvotes: 2
Views: 2741
Reputation: 595827
In your CM_HINTSHOW
message handler, you can cast the lParam
value to a PHintInfo
pointer and then customize its fields as needed. For instance, to simply change the background color, set the THintInfo.HintColor
field. To change the layout of the hint, you can derive a new class from THintWindow
and assign that class type to the THintInfo.HintWindowClass
field.
Let the VCL manage the hint for you, including showing and hiding it.
Upvotes: 6