mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 17:19:23 +02:00
IdeIntf: Clean TOICustomPropertyGrid.HintTimer
git-svn-id: trunk@45831 -
This commit is contained in:
parent
613426fbe9
commit
a8c3ea866d
@ -3213,33 +3213,13 @@ end;
|
|||||||
|
|
||||||
procedure TOICustomPropertyGrid.HintTimer(Sender: TObject);
|
procedure TOICustomPropertyGrid.HintTimer(Sender: TObject);
|
||||||
var
|
var
|
||||||
Position : TPoint;
|
|
||||||
Index: integer;
|
|
||||||
PointedRow: TOIpropertyGridRow;
|
PointedRow: TOIpropertyGridRow;
|
||||||
|
|
||||||
procedure HintByHandler;
|
|
||||||
var
|
|
||||||
AHint: String;
|
|
||||||
begin
|
|
||||||
if OnPropertyHint(Self, PointedRow, AHint)
|
|
||||||
then begin
|
|
||||||
FHintIndex := Index;
|
|
||||||
FShowingLongHint := True;
|
|
||||||
FHintManager.ShowHint(Position, AHint);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure HintByEditor(AHint: String);
|
|
||||||
begin
|
|
||||||
FHintIndex := Index;
|
|
||||||
FShowingLongHint := True;
|
|
||||||
FHintManager.ShowHint(Position, AHint);
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
|
||||||
Window: TWinControl;
|
Window: TWinControl;
|
||||||
HintType: TPropEditHint;
|
HintType: TPropEditHint;
|
||||||
ClientPosition: TPoint;
|
Position, ClientPosition: TPoint;
|
||||||
|
Index: integer;
|
||||||
|
AHint: String;
|
||||||
|
OkToShow: Boolean;
|
||||||
begin
|
begin
|
||||||
if FHintTimer <> nil then
|
if FHintTimer <> nil then
|
||||||
FHintTimer.Enabled := False;
|
FHintTimer.Enabled := False;
|
||||||
@ -3255,16 +3235,24 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
Index := MouseToIndex(ClientPosition.Y, False);
|
Index := MouseToIndex(ClientPosition.Y, False);
|
||||||
if (Index < 0) or (Index >= FRows.Count) then Exit;
|
// Don't show hint for the selected property.
|
||||||
PointedRow := Rows[Index];
|
if (Index < 0) or (Index >= FRows.Count) or (Index = ItemIndex) then Exit;
|
||||||
if (PointedRow = Nil) or (PointedRow.Editor = Nil)
|
|
||||||
or (Index = ItemIndex) then Exit; // Don't show hint for the selected property.
|
|
||||||
|
|
||||||
|
PointedRow := Rows[Index];
|
||||||
|
if (PointedRow = Nil) or (PointedRow.Editor = Nil) then Exit;
|
||||||
|
|
||||||
|
// Get hint
|
||||||
|
OkToShow := True;
|
||||||
HintType := GetHintTypeAt(Index, Position.X);
|
HintType := GetHintTypeAt(Index, Position.X);
|
||||||
if (HintType = pehName) and Assigned(OnPropertyHint) then
|
if (HintType = pehName) and Assigned(OnPropertyHint) then
|
||||||
HintByHandler
|
OkToShow := OnPropertyHint(Self, PointedRow, AHint)
|
||||||
else
|
else
|
||||||
HintByEditor(PointedRow.Editor.GetHint(HintType, Position.X, Position.Y));
|
AHint := PointedRow.Editor.GetHint(HintType, Position.X, Position.Y);
|
||||||
|
// Show hint if all is well.
|
||||||
|
if OkToShow and FHintManager.ShowHint(Position, AHint) then begin
|
||||||
|
FHintIndex := Index;
|
||||||
|
FShowingLongHint := True;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOICustomPropertyGrid.ResetHintTimer;
|
procedure TOICustomPropertyGrid.ResetHintTimer;
|
||||||
|
Loading…
Reference in New Issue
Block a user