╩αΩ "ß√±≥≡≤■ ∩εΣ±ΩατΩ≤" (Hints) ±Σσδα≥ⁿ ∞φεπε±≥≡ε≈φεΘ?
═σεß⌡εΣΦ∞ε ±ετΣα≥ⁿ ±εε≥Γσ≥±≥Γ≤■∙≤■ Ωε∞∩εφσφ≥≤ Ωε≥ε≡α ∩εΩατ√Γασ≥ "ß√±≥≡≤■ ∩εΣ±ΩατΩ≤" (Hints) ± ßεδσσ
≈σ∞ εΣφεΘ ±≥≡εΩεΘ.
╩ε∞∩εφσφ≥α φα±δσΣ≤σ≥± ε≥ TComponent Φ φατ√Γασ≥± TMHint. Hint-≥σΩ±≥ ∞εµφε ταΣαΓα≥ⁿ ±δσΣ≤■∙Φ∞ εß≡ατε∞:
"╤≥≡εΩα 1@╤≥≡εΩα 2@╤≥≡εΩα 3". ╤Φ∞Γεδ '@' Φ±∩εδⁿτ≤σ≥± ΩαΩ ≡ατΣσδΦ≥σδⁿ ±≥≡εΩ. ┼±δΦ ┬α∞ φ≡αΓΦ≥± Σ≡≤πεΘ
±Φ∞Γεδ - Φτ∞σφΦ≥σ ±ΓεΘ±≥Γε Separator. ╤ΓεΘ±≥Γε Active ≤Ωατ√Γασ≥ φα αΩ≥ΦΓφε±≥ⁿ (TRUE) ΦδΦ φσαΩ≥ΦΓφε±≥ⁿ
(FALSE) "∞φεπε±≥≡ε≈φε±≥Φ".
unit MHint;
interface
uses
SysUtils, WinTypes, WinProcs, Messages,
Classes, Graphics, Controls, Forms, Dialogs;
type
TMHint = class(TComponent)
private
ScreenSize: Integer;
FActive: Boolean;
FSeparator: Char;
FOnShowHint: TShowHintEvent;
protected
procedure SetActive(Value: Boolean);
procedure SetSeparator(Value: char);
procedure NewHintInfo(var HintStr: string;
var CanShow: Boolean;
var HintInfo: THintInfo);
public
constructor Create(AOwner: TComponent); override;
published
property Active: Boolean
read FActive write SetActive;
property Separator: Char
read FSeparator write SetSeparator;
end;
procedure Register;
implementation
constructor TMHint.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FActive := True;
FSeparator := '@';
Application.OnShowHint := NewHintInfo;
ScreenSize := GetSystemMetrics(SM_CYSCREEN);
end;
procedure TMHint.SetActive(Value: Boolean);
begin
FActive := Value;
end;
procedure TMHint.SetSeparator(Value: Char);
begin
FSeparator := Value;
end;
procedure TMHint.NewHintInfo(var HintStr: string;
var CanShow: Boolean;
var HintInfo: THintInfo);
var
I: Byte;
begin
if FActive then
begin
I := Pos(FSeparator, HintStr);
while I > 0 do
begin
HintStr[I] := #13;
I := Pos(FSeparator, HintStr);
end;
if HintInfo.HintPos.Y+10 > ScreenSize then
HintInfo.HintPos.Y := ScreenSize-11;
end;
end;
procedure Register;
begin
RegisterComponents('MyComponents', [TMHint]);
end;
end.
╚δΦ Γε≥ σ∙╕ ∩≡Φ∞σ≡.
╤εΓσ≥√ φα≈Φφα■∙Φ∞