Good day.
Well, yes, I posted it in the wrong section. I'll be more careful. In addition, I forgot to add one unit to the archive. Here he is.
unit msg_Hint;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, LazUtf8, Forms, Controls;
type
TMsgHint = Class(THintWindow)
public
constructor Create(aOwner: TComponent); override;
destructor Destroy; override;
{Устанавливает над компонентом aControl Нint c c сообщением aMsg. Внимание:
компонент aControl должен иметь родителя. }
procedure SetScope(aControl: TControl; aMsg: string);
end;
implementation
constructor TMsgHint.Create(aOwner: TComponent);
begin
inherited Create(aOwner);
Self.HideInterval:= 4000; //время показа сообщения 4с.
Self.AutoHide:= True;
Self.Color := $00B3FFFF; //слоновая кость
Self.Font.Color:= $000404FF; //красно-коричневый
Self.Alignment:= taRightJustify;
end;
destructor TMsgHint.Destroy;
begin
inherited Destroy;
end;
procedure TMsgHint.SetScope(aControl: TControl; aMsg: string);
var
Rect : TRect;
pnt : TPoint;
begin
Rect:= Self.CalcHintRect(0, aMsg, nil);
if aControl.Width> Rect.Right then
Rect.Right:= aControl.Width;
pnt:= aControl.ClientOrigin;
Rect.Left:= pnt.X-2; Rect.Top := pnt.Y-Rect.Bottom;
Rect.Right:= pnt.X+Rect.Right-2; Rect.Bottom:= pnt.Y;
Self.ActivateHint(Rect, aMsg);
end;
end.