Ткните меня куда-нибудь носом на эту тему

Модератор: Модераторы
Unit Unit1;
{$mode objfpc}{$H+}
Interface
Uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons;
Type
{ BHintForm }
{ BHintFormClass }
BHintFormClass = Class(TForm)
Private
bBox: TListBox;
Public
Property Box: TListBox Read bBox;
Procedure ShowMe;
Constructor Build;
Destructor Burn;
End;
Type
{ TForm1 }
TForm1 = Class(TForm)
Procedure FormCreate(Sender: TObject);
Private
{ private declarations }
bHintForm: BHintFormClass;
Public
{ public declarations }
Procedure MyOnHint(Sender: TObject);
End;
Var
Form1: TForm1;
Implementation
{$R *.lfm}
{ TForm1 }
Procedure TForm1.FormCreate(Sender: TObject);
Var
i: Integer;
Begin
bHintForm := BHintFormClass.Build;
For i := 1 To 3 Do
With TSpeedButton.Create(Self) Do
Begin
Parent := Self;
ShowHint := TRUE;
Caption := IntToStr(i);
Hint := Caption;
Left := i * (Width + 10);
End;
Application.OnHint := @MyOnHint;
end;
Procedure TForm1.MyOnHint(Sender: TObject);
Begin
Application.HideHint;
Application.ProcessMessages;
bHintForm.ShowMe;
Application.ShowHint := TRUE;
End;
{ BHintFormClass }
Procedure BHintFormClass.ShowMe;
Begin
Top := Mouse.CursorPos.Y;
Left := Mouse.CursorPos.X;
Show;
End;
Constructor BHintFormClass.Build;
Begin
Inherited Create(Application);
bBox := TListBox.Create(Self);
bBox.Parent := Self;
bBox.Align := alClient;
Width := 100;
Height := 100;
BorderStyle := bsNone;
End;
Destructor BHintFormClass.Burn;
Begin
Box.Free;
Inherited Destroy;
End;
End.
Сейчас этот форум просматривают: Google [Bot] и гости: 233