View Issue Details

IDProjectCategoryView StatusLast Update
0014059LazarusLCLpublic2011-07-13 23:08
ReporterGraeme Geldenhuys Assigned ToJuha Manninen  
Status resolvedResolutionfixed 
Platformx86OSUbuntu Linux 
Product Version0.9.27 (SVN) 
Summary0014059: TDateEdit: Main form's focus is lost when dropdown calendar is shown
DescriptionSee attached screenshot. When the dropdown calendar is shown, the main form doesn't seem to have focus anymore. This is not normal behaviour for drowdown windows (take TComboBox for example).

Only tested on GTK2 widgetset.
TagsNo tags attached.
Fixed in Revisionr31682
WidgetsetGTK 2
Attached Files


related to 0010190 closedPaul Ishenin TCalendar crash when activating dsShowWeekNumbers through OI 
related to 0014058 resolvedJuha Manninen TDateEdit: dropdown calendar doesn't close when I click outside it 


2009-06-26 10:21


screenshot.png (6,121 bytes)   
screenshot.png (6,121 bytes)   

Vincent Snijders

2009-06-29 11:38

manager   ~0028840

This one may be hard to fix.

Gerard V

2011-07-09 18:50

reporter   ~0049844

I has a complaint from a user on this one. I saw that the calendar popup is shown modal, so that disables the underlying form.
I had a look at lcl/forms/calendarpopup.pas and at line 62:

procedure ShowCalendarPopup(const Position: TPoint; ADate: TDateTime;
  const CalendarDisplaySettings: TDisplaySettings;
  const OnReturnDate: TReturnDateEvent; const OnShowHide: TNotifyEvent = nil);
  PopupForm: TCalendarPopupForm;
  PopupForm := TCalendarPopupForm.Create(nil);
  PopupForm.Initialize(Position, ADate, CalendarDisplaySettings);
  PopupForm.FOnReturnDate := OnReturnDate;
  PopupForm.OnShow := OnShowHide;
  PopupForm.OnHide := OnShowHide;
  //TODO: Change to PopupForm.Show when gtk supports non modal forms on top of
  //modal forms.
  {$IFDEF windows}

Just to see what happens, I changed it to PopupForm.Show, with no ifdefs.
It seems to work well under GTK2 (2.22) 64 bits and Windows XP 32.
Can someone test the uploaded patch with other widgetsets? (especially with older versions of GTK2)

2011-07-09 18:50


nonmodal_calendarpopup.patch (523 bytes)   
Index: calendarpopup.pas
--- calendarpopup.pas	(revision 31619)
+++ calendarpopup.pas	(working copy)
@@ -70,13 +70,7 @@
   PopupForm.FOnReturnDate := OnReturnDate;
   PopupForm.OnShow := OnShowHide;
   PopupForm.OnHide := OnShowHide;
-  //TODO: Change to PopupForm.Show when gtk supports non modal forms on top of
-  //modal forms.
-  {$IFDEF windows}
-  {$ELSE}
-  PopupForm.ShowModal;
-  {$ENDIF}
 { TCalendarPopupForm }

Juha Manninen

2011-07-12 20:35

developer   ~0049914

Thanks, applied. Please test.

Zeljan Rikalo

2011-07-13 08:29

developer   ~0049926

I don't understand WHY we need form as container for calendar in this case ??
Isn't calendar TWinControl by it self ?
How do you expect to show another form over TDateEdit form and focus stays unchanged (without adding csNoFocus or similar to form) ?

Gerard V

2011-07-13 18:34

reporter   ~0049945

@Juha: It works on my computer, but if someone wrote the following comment:
  //TODO: Change to PopupForm.Show when gtk supports non modal forms on top of
  //modal forms.
then it may mean that on some previous version of GTK it didn't work.

Flávio Etrusco

2011-07-13 21:33

developer   ~0049954

@Zeljan: I guess I'm missing something? :S Because the calendar can't be a top-level window and won't fit inside the edit?

Flávio Etrusco

2011-07-13 21:36

developer   ~0049955

@Gerard: indeed. If only the comment author had stated to which version was he referring :-/

Juha Manninen

2011-07-13 23:08

developer   ~0049961

@Gerard and Flávio:
I also realize the issue with old GTK versions. If someone finds a version where it doesn't work and which is still supported by Lazarus then we add some IFDEFs.
Does it really mean GTK (not supported) or GTK2?

Issue History

Date Modified Username Field Change
2009-06-26 10:21 Graeme Geldenhuys New Issue
2009-06-26 10:21 Graeme Geldenhuys File Added: screenshot.png
2009-06-26 10:21 Graeme Geldenhuys Widgetset => GTK 2
2009-06-29 11:38 Vincent Snijders LazTarget => 1.2
2009-06-29 11:38 Vincent Snijders Note Added: 0028840
2009-06-29 11:38 Vincent Snijders Status new => acknowledged
2009-06-29 11:38 Vincent Snijders Relationship added related to 0014058
2010-12-20 13:31 Juha Manninen Relationship added related to 0010190
2011-07-09 18:50 Gerard V Note Added: 0049844
2011-07-09 18:50 Gerard V File Added: nonmodal_calendarpopup.patch
2011-07-12 20:16 Juha Manninen Status acknowledged => assigned
2011-07-12 20:16 Juha Manninen Assigned To => Juha Manninen
2011-07-12 20:35 Juha Manninen Fixed in Revision => r31682
2011-07-12 20:35 Juha Manninen Status assigned => resolved
2011-07-12 20:35 Juha Manninen Resolution open => fixed
2011-07-12 20:35 Juha Manninen Note Added: 0049914
2011-07-13 08:29 Zeljan Rikalo Note Added: 0049926
2011-07-13 18:34 Gerard V Note Added: 0049945
2011-07-13 21:33 Flávio Etrusco Note Added: 0049954
2011-07-13 21:36 Flávio Etrusco Note Added: 0049955
2011-07-13 23:08 Juha Manninen Note Added: 0049961