AData 指的是什么?
能否给个具体例子?
----AData是一个(关联的)指针,
目前来说, ActivateHintData和ActivateHint等效, 因为AData参数被忽略.
在THintWindow类中, ActivateHintData被定义成Virtual的,
后代类可以重载这个方法, 把AHint 和AData所关联的信息
重新组合成自己需要的HINT方式.
以下是THintWindow的源码部分:
procedure THintWindow.ActivateHint(Rect: TRect; const AHint: string);
begin
FActivating := True;
try
Caption := AHint;
Inc(Rect.Bottom, 4);
UpdateBoundsRect(Rect);
if Rect.Top + Height > Screen.DesktopHeight then
Rect.Top := Screen.DesktopHeight - Height;
if Rect.Left + Width > Screen.DesktopWidth then
Rect.Left := Screen.DesktopWidth - Width;
if Rect.Left < Screen.DesktopLeft then Rect.Left := Screen.DesktopLeft;
if Rect.Bottom < Screen.DesktopTop then Rect.Bottom := Screen.DesktopTop;
SetWindowPos(Handle, HWND_TOPMOST, Rect.Left, Rect.Top, Width, Height,
SWP_SHOWWINDOW or SWP_NOACTIVATE);
Invalidate;
finally
FActivating := False;
end;
end;
procedure THintWindow.ActivateHintData(Rect: TRect; const AHint: string; AData: Pointer);
begin
ActivateHint(Rect, AHint);//AData参数被忽略, 你可以传个nil, 或任意一个指针
end;