View Issue Details

IDProjectCategoryView StatusLast Update
0026852LazarusLCLpublic2015-01-06 11:34
ReporterEdio Smanio JuniorAssigned ToBart Broersma 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformi386OSWin32OS VersionXP
Product Version1.2.4Product Build 
Target Version1.2.8Fixed in Version 
Summary0026852: TCalendarDialog date selection failure
DescriptionAfter selecting a date by double clicking the calendar, the property date is not updated correctly in any event (OnDayChange, OnMonthChange or OnYearChange). the property date allways shows the date before the change(selection)
Steps To ReproduceCalendar.execute
//---
procedure TForm.CalendarDayChanged(Sender: TObject);
begin
   E_Date.Text:=FormatDateTime('dd-mm-yy',Calendar.Date);
end;
//--- E_Date.Text is allways one selection behind.
Additional InformationThe same hapens in Lazarus 1.0.10
Works OK in Linux
TagsNo tags attached.
Fixed in Revisionr46791
LazTarget1.2.8
Widgetset
Attached Files

Relationships

related to 0027125 closedZeljan Rikalo TCustomCalendar.Date is wrong inside OnXXXChanged events on Linux-QT 

Activities

Bart Broersma

2014-10-13 21:31

developer   ~0078202

Please attach a compilable sample project demonstrating the issue.

Edio Smanio Junior

2014-10-13 23:08

reporter  

Calendar.zip (325,733 bytes)

Edio Smanio Junior

2014-10-13 23:10

reporter   ~0078209

I Uploaded a projet showing the issue, there is also a timer to show the property date after leaving the event, when the property becomes OK.

Edio Smanio Junior

2014-10-14 00:23

reporter   ~0078210

Last edited: 2014-10-14 20:00

View 3 revisions

Analysing extdlgs.pas and Tcalendar component, I found that TCalendar first execs OnDayChange and then OnDblClick.
    So in TCalendarDialog OnDayChanged executes before GetNewDate(Sender); {line 1256 extdlgs.pas} is executed and property date is updated.

Bart Broersma

2014-11-09 15:06

developer   ~0079043

When clicking on a date, the CalendarDialog.DateTime does not get updated.
I am not sure wether this is intended or not.

For me the real question is: why should TCalendarDialog have these events at all.
A normal workflow would consist of:
...
if CalendarDialog1.Execute then MyDate := CalendarDialog1.Date;
...

The dialog should hide the internal working of TCalendar.
IMO TCalendarDialog.Date should behave just as TOpenDialog.Filename: it's value has no meaning unless the Execute function retruns True.

If we want to have OnDayChanged etc, reflect the current day in the calendar then this can easily be implemented.
But the, why not have an OnChange event as well?

Bart Broersma

2014-11-09 19:37

developer   ~0079055

Please test and close if OK.

Edio Smanio Junior

2014-11-19 23:24

reporter   ~0079224

Last edited: 2014-11-24 18:06

View 3 revisions

"I am not sure wether this is intended or not."

 TCalendarDialog behave the same in Delphi7 and Lazarus in Linux.
 but not in lazarus in Windows.
 The "compile everywhere" question sugests, at least, that Lazarus behave the same Win and Linux, so it's better to move Lazarus Win closer to Delphi than to move Lazarus Linux away from Delphi.

  The central point is "the component has non working events", correct the error or remove the events, it is pointless to have a non working function no one is willing to fix.

  The fact that there is a work around just mitigate the problem, do not solve it.

Bart Broersma

2014-11-24 18:36

developer   ~0079368

@Edio Smanio Junior: either re-open this issue if you think my fix is incrrect, otherwise close this issue.
It makes no sense discussing when the issue is marked as resolved.
Most likely when you do such a thing, your comments remain unnoticed.

With my fix, TCalendarDialog.Date gets updated on evrey change of the Calendar and the appropriate events are called.
All tested on Windows.
My Delphi 7 does not have a TCalendarDialog, so I cannot test Lazarus behaviour against that. So if newer Delphi's do have this dialog (with the same name!) and it behaves different from current (= trunk) Lazarus implementation, please mention how it differs.

Edio Smanio Junior

2014-12-02 19:00

reporter   ~0079572

Last edited: 2014-12-02 19:00

View 2 revisions

Thank you Bart for your time, but I must confess that I'am a little disapointed. forget about Delphi, Lazarus is behaving differently Win and Lin and setting apart god programming technics, it is something IMHO is not supposed to happen.
 anyway I'am a dinosaur from 16k pre CP/M era, I understand that multi-plataform several MB software you should have a tighter schedule.

Bart Broersma

2014-12-03 12:28

developer   ~0079589

Last edited: 2014-12-03 12:58

View 3 revisions

OK,
1. in what way does TCalendarDialog on Linux behave different compared to Windows?
2. does TCalendarDialog now behave as (you) expected on Windows?

Use attached project in cal.zip for testing please.
(It creates a TCalendar instance in the form as well for comparison)

Expected behaviour: whenever you change a date in the CalendarDialog (using muse or keyboard) the OnDayChanged for TCalendarDialog gets fired, and inside that event CalendarDialog1.Date shows the actual selected date inside the dialog.
You need trunk to test this.

Bart Broersma

2014-12-03 15:42

developer   ~0079595

Last edited: 2014-12-03 16:16

View 5 revisions

The events that each WS fires differs.
See 0027125.

For GTK2, QT-Linux and Windows WidgetSets, the only sure thing is that OnChange event will be fired.

Bart Broersma

2014-12-03 16:02

developer  

cal.zip (65,164 bytes)

Zeljan Rikalo

2014-12-04 10:12

developer   ~0079630

I've fixed Qt, so it fires as expected.

Bart Broersma

2015-01-06 11:34

developer   ~0080148

No feedback.

Issue History

Date Modified Username Field Change
2014-10-13 20:49 Edio Smanio Junior New Issue
2014-10-13 21:31 Bart Broersma LazTarget => -
2014-10-13 21:31 Bart Broersma Note Added: 0078202
2014-10-13 21:31 Bart Broersma Status new => feedback
2014-10-13 23:08 Edio Smanio Junior File Added: Calendar.zip
2014-10-13 23:10 Edio Smanio Junior Note Added: 0078209
2014-10-13 23:10 Edio Smanio Junior Status feedback => new
2014-10-14 00:23 Edio Smanio Junior Note Added: 0078210
2014-10-14 00:26 Edio Smanio Junior Note Edited: 0078210 View Revisions
2014-10-14 20:00 Edio Smanio Junior Note Edited: 0078210 View Revisions
2014-11-09 15:06 Bart Broersma Note Added: 0079043
2014-11-09 17:09 Bart Broersma Assigned To => Bart Broersma
2014-11-09 17:09 Bart Broersma Status new => assigned
2014-11-09 18:00 Bart Broersma LazTarget - => 1.4
2014-11-09 18:00 Bart Broersma Category Compiler => LCL
2014-11-09 19:37 Bart Broersma Fixed in Revision => r46791
2014-11-09 19:37 Bart Broersma LazTarget 1.4 => 1.2.8
2014-11-09 19:37 Bart Broersma Note Added: 0079055
2014-11-09 19:37 Bart Broersma Status assigned => resolved
2014-11-09 19:37 Bart Broersma Resolution open => fixed
2014-11-09 19:37 Bart Broersma Target Version => 1.2.8
2014-11-19 23:24 Edio Smanio Junior Note Added: 0079224
2014-11-24 18:06 Edio Smanio Junior Note Edited: 0079224 View Revisions
2014-11-24 18:06 Edio Smanio Junior Note Edited: 0079224 View Revisions
2014-11-24 18:36 Bart Broersma Note Added: 0079368
2014-12-02 19:00 Edio Smanio Junior Note Added: 0079572
2014-12-02 19:00 Edio Smanio Junior Note Edited: 0079572 View Revisions
2014-12-03 12:28 Bart Broersma Note Added: 0079589
2014-12-03 12:28 Bart Broersma Status resolved => feedback
2014-12-03 12:53 Bart Broersma File Added: cal.zip
2014-12-03 12:54 Bart Broersma Note Edited: 0079589 View Revisions
2014-12-03 12:58 Bart Broersma Note Edited: 0079589 View Revisions
2014-12-03 15:42 Bart Broersma Note Added: 0079595
2014-12-03 15:55 Bart Broersma Note Edited: 0079595 View Revisions
2014-12-03 15:55 Bart Broersma Note View State: 0079595: public
2014-12-03 15:58 Bart Broersma Note Edited: 0079595 View Revisions
2014-12-03 16:01 Bart Broersma Note Edited: 0079595 View Revisions
2014-12-03 16:01 Bart Broersma File Deleted: cal.zip
2014-12-03 16:02 Bart Broersma File Added: cal.zip
2014-12-03 16:13 Bart Broersma Relationship added related to 0027125
2014-12-03 16:16 Bart Broersma Note Edited: 0079595 View Revisions
2014-12-04 10:12 Zeljan Rikalo Note Added: 0079630
2015-01-06 11:34 Bart Broersma Note Added: 0080148
2015-01-06 11:34 Bart Broersma Status feedback => resolved
2015-01-06 11:34 Bart Broersma Status resolved => closed