Recent

Author Topic: [SOLVED] TCalendar Change?  (Read 5300 times)

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
[SOLVED] TCalendar Change?
« on: February 29, 2012, 01:50:41 pm »
I have just got another PC - previously I had Windows XP, but on my new PC I have Win7.

My application uses TCalender to select a date of records to examine.  On XP CalDayChanged returns dd/mm/yyyy in Cal.date but after recompiling under Win7, Cal.Date returns dd-Mmm-yyyy (as in 29-Feb-2012).   Am I missing something here or is this a compatibility issue with 'write once - compile anywhere'?
« Last Edit: February 29, 2012, 09:51:40 pm by Pascaluvr »
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

zeljko

  • Hero Member
  • *****
  • Posts: 1760
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: TCalendar Change?
« Reply #1 on: February 29, 2012, 02:23:34 pm »
afair, there's bug in fpc which does not read properly locales on win7, so it assumes defaults OR check your locale settings for dates in cpl.

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
Re: TCalendar Change?
« Reply #2 on: February 29, 2012, 02:38:50 pm »
Thank you for your prompt reply... and while I thought I was reasonably computer savy...   I have no idea what this means:

"OR check your locale settings for dates in cpl."

cpl?????

Thanks again
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: TCalendar Change?
« Reply #3 on: February 29, 2012, 02:43:01 pm »
cpl = Control Panel/Regional Settings
Lazarus Trunk / fpc 2.6.2 / Win32

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
Re: TCalendar Change?
« Reply #4 on: February 29, 2012, 02:58:12 pm »
Thanks for that.  Strangely, there is no setting for the XP response.  What is worse, is that if I give my program to someone else, they have to change the settings on their computer to suit my needs,,, and possibly screw up other programs!

Surely 'Write once  - compile anywhere' doesn't come with fine print for common functions.

Don't get me wrong... Laz/FPC are great products and I'm not criticizing... but for compatibility surely the Lazarus function should return the same, regardless of cpl settings?
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: TCalendar Change?
« Reply #5 on: February 29, 2012, 03:30:32 pm »
You can try this:

procedure TForm1.CalChange(Sender: TObject);
begin
  Edit1.Text:= FormatDateTime('dd/mm/yyyy',Cal.DateTime);
end;
Lazarus Trunk / fpc 2.6.2 / Win32

paweld

  • Hero Member
  • *****
  • Posts: 1418
Re: TCalendar Change?
« Reply #6 on: February 29, 2012, 07:11:19 pm »
or in FormCreate set:
Code: [Select]
ShortDateFormat:='dd-mm-yyyy';
Best regards / Pozdrawiam
paweld

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
Re: TCalendar Change?
« Reply #7 on: February 29, 2012, 09:50:55 pm »
or in FormCreate set:
Code: [Select]
ShortDateFormat:='dd-mm-yyyy';

Thank you = that was the problem.  I hadn't set the date format in Control Panel.  I will also add this code so that my program will run on someone else's computer.
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

 

TinyPortal © 2005-2018