mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 17:20:56 +02:00
LCL: TimePopupForm: keep the form in view when switchin to non-simple layout.
git-svn-id: trunk@49851 -
This commit is contained in:
parent
108a741bb8
commit
78c3da20fa
@ -40,10 +40,12 @@ type
|
|||||||
FClosed: Boolean;
|
FClosed: Boolean;
|
||||||
FOnReturnTime: TReturnTimeEvent;
|
FOnReturnTime: TReturnTimeEvent;
|
||||||
FSimpleLayout: Boolean;
|
FSimpleLayout: Boolean;
|
||||||
|
FPopupOrigin: TPoint;
|
||||||
procedure ActivateDoubleBuffered;
|
procedure ActivateDoubleBuffered;
|
||||||
procedure CalcGridHeights;
|
procedure CalcGridHeights;
|
||||||
function GetTime: TDateTime;
|
function GetTime: TDateTime;
|
||||||
procedure Initialize(const PopupOrigin: TPoint; ATime: TDateTime);
|
procedure Initialize(const PopupOrigin: TPoint; ATime: TDateTime);
|
||||||
|
procedure KeepInView(const PopupOrigin: TPoint);
|
||||||
procedure ReturnTime;
|
procedure ReturnTime;
|
||||||
procedure SetLayout(SimpleLayout: Boolean);
|
procedure SetLayout(SimpleLayout: Boolean);
|
||||||
procedure SetTime(ATime: TDateTime);
|
procedure SetTime(ATime: TDateTime);
|
||||||
@ -76,6 +78,7 @@ begin
|
|||||||
if not SimpleLayout then
|
if not SimpleLayout then
|
||||||
NewForm.SetTime(ATime); //update the row and col in the grid;
|
NewForm.SetTime(ATime); //update the row and col in the grid;
|
||||||
NewForm.Show;
|
NewForm.Show;
|
||||||
|
NewForm.KeepInView(Position);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTimePopupForm.SetTime(ATime: TDateTime);
|
procedure TTimePopupForm.SetTime(ATime: TDateTime);
|
||||||
@ -205,6 +208,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
CalcGridHeights;
|
CalcGridHeights;
|
||||||
FSimpleLayout := SimpleLayout;
|
FSimpleLayout := SimpleLayout;
|
||||||
|
KeepInView(FPopupOrigin);
|
||||||
finally
|
finally
|
||||||
MinutesGrid.EndUpdate(True);
|
MinutesGrid.EndUpdate(True);
|
||||||
end;
|
end;
|
||||||
@ -245,6 +249,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTimePopupForm.Initialize(const PopupOrigin: TPoint; ATime: TDateTime);
|
procedure TTimePopupForm.Initialize(const PopupOrigin: TPoint; ATime: TDateTime);
|
||||||
|
begin
|
||||||
|
FPopupOrigin := PopupOrigin;
|
||||||
|
KeepInView(PopupOrigin);
|
||||||
|
SetTime(ATime);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTimePopupForm.KeepInView(const PopupOrigin: TPoint);
|
||||||
var
|
var
|
||||||
ABounds: TRect;
|
ABounds: TRect;
|
||||||
begin
|
begin
|
||||||
@ -257,7 +268,8 @@ begin
|
|||||||
Top := ABounds.Bottom - Height
|
Top := ABounds.Bottom - Height
|
||||||
else
|
else
|
||||||
Top := PopupOrigin.Y;
|
Top := PopupOrigin.Y;
|
||||||
SetTime(ATime);
|
//store the fitting point, so the form won't move if it layout is changed back to simple
|
||||||
|
FPopupOrigin := Point(Left, Top);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTimePopupForm.ReturnTime;
|
procedure TTimePopupForm.ReturnTime;
|
||||||
|
Loading…
Reference in New Issue
Block a user