[lazarus] TCalendar reporting wrong month...

Tony Maro tony at maro.net
Fri Apr 25 01:41:19 EDT 2003


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), at 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.







More information about the Lazarus mailing list