LCL: Close calendar popup also when the application loses focus. Issue #20171

git-svn-id: trunk@33131 -
This commit is contained in:
juha 2011-10-28 09:15:13 +00:00
parent 680ef77895
commit 79353aa2a5
2 changed files with 13 additions and 5 deletions

View File

@ -10,14 +10,15 @@ object CalendarPopupForm: TCalendarPopupForm
ClientHeight = 192
ClientWidth = 233
OnClose = FormClose
OnCreate = FormCreate
OnDeactivate = FormDeactivate
PopupMode = pmAuto
LCLVersion = '0.9.29'
LCLVersion = '0.9.31'
object Calendar: TCalendar
Left = 1
Height = 153
Height = 176
Top = 1
Width = 162
Width = 177
AutoSize = True
BorderSpacing.Around = 1
DateTime = 38823

View File

@ -38,6 +38,7 @@ type
procedure CalendarDblClick(Sender: TObject);
procedure CalendarKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormDeactivate(Sender: TObject);
private
FClosed: boolean;
@ -75,11 +76,17 @@ end;
{ TCalendarPopupForm }
procedure TCalendarPopupForm.FormClose(Sender: TObject;
var CloseAction: TCloseAction);
procedure TCalendarPopupForm.FormCreate(Sender: TObject);
begin
FClosed := false;
Application.AddOnDeactivateHandler(@FormDeactivate);
end;
procedure TCalendarPopupForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
//DebugLn(['TCalendarPopupForm.FormClose ']);
FClosed := true;
Application.RemoveOnDeactivateHandler(@FormDeactivate);
CloseAction := caFree;
end;