Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-04

TCalendar reporting wrong month...

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tony Maro
to Tony Maro
Tony Maro wrote
The TCalendar component DATE property is reporting one month behind what the display shows, even in design mode.

Found the problem in the GTK object interface for the TCalendar.

TGtkObject.GetValue in gtkobject.inc even notes that the month field is zero based, but doesn't account for it. Recently changed... because it worked a few days ago.

Here's what I did to my code - couldn't make a diff because the DNS servers serving freepascal.org are down.

  csCalendar :
    Begin
      gtk_calendar_get_date(PgtkCalendar(handle),@Year, @Month, @Day);
      //TODO:  account for local settings like date format
      //Form some reason, the month is zero based.
      TLMCalendar(data^).Date := EncodeDate(Year,Month+1,Day);
    end;

The "+1" after "Month" is what I added.

Reply by email

Mattias Gaertner
to Tony Maro: The TCalendar component DATE property is reporting one month behind what the display…
Show quoted text 23 lines
Tony Maro wrote: > The TCalendar component DATE property is reporting one month behind > what the display shows, even in design mode. Found the problem in the GTK object interface for the TCalendar. TGtkObject.GetValue in gtkobject.inc even notes that the month field is zero based, but doesn't account for it. Recently changed... because it worked a few days ago. Here's what I did to my code - couldn't make a diff because the DNS servers serving freepascal.org are down. csCalendar : Begin gtk_calendar_get_date(PgtkCalendar(handle),@Year, @Month, @Day); //TODO: account for local settings like date format //Form some reason, the month is zero based. TLMCalendar(data^).Date := EncodeDate(Year,Month+1,Day); end; The "+1" after "Month" is what I added.

The cvs.freepascal is back again and I applied your +1.

Mattias

Reply by email