Recent

Author Topic: TDateEdit Events problem  (Read 2238 times)

AKCarlow

  • New member
  • *
  • Posts: 45
TDateEdit Events problem
« on: August 07, 2014, 09:33:40 pm »
I have added a TDateEdit to a form. I want to do stuff after the user has chosen a date, so I put a ShowMessage in several of the events. I tried OnEditingDone. When running the program, I click the calendar icon, browse to the desired date, double-click to select it, then click elsewhere in the form. OnEditingDone doesn't fire, so I tried OnExit, and OnChange, but they don't fire either.

If I click back into the displayed date, then click away, OnExit fires - probably the others too. But how can I react to that simple picking a date from the calendar?
Using: OS-X 10.6.8, Lazarus 1.2.4, FPC 2.6.4,  MySQL 5.6.19 (32-bit)

Blaazen

  • Hero Member
  • *****
  • Posts: 2782
  • POKE 54296,15
    • Eye-Candy Controls
Re: TDateEdit Events problem
« Reply #1 on: August 07, 2014, 09:46:28 pm »
TEditButton (ancestor of TDateEdit) was recently redesigned. I don't know if the new design is already in Laz. 1.2.4. However, I tested OnEditingDone in Laz. 1.3 (today's SVN) and works well. Solution for you is to use Laz. 1.3. You can also try event OnAcceptDate, which is triggered after picking the date from the calendar and works well here too.
Lazarus 2.1.0 r59757M FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.2, Plasma 5.14.2
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

AKCarlow

  • New member
  • *
  • Posts: 45
Re: TDateEdit Events problem
« Reply #2 on: August 08, 2014, 01:25:21 am »
Thanks.

I actually tried OnAcceptDate first, but a ShowMessage there caused a hang. I suspect that handler is meant to return the boolean AcceptDate, and putting in a modal stops that happening so nothing happens. As I wanted to see what way the date was coming back I tried the other handlers rather than pressing on with OnAcceptDate.

Do you know when 1.3 will be released?
Using: OS-X 10.6.8, Lazarus 1.2.4, FPC 2.6.4,  MySQL 5.6.19 (32-bit)

Blaazen

  • Hero Member
  • *****
  • Posts: 2782
  • POKE 54296,15
    • Eye-Candy Controls
Re: TDateEdit Events problem
« Reply #3 on: August 08, 2014, 10:23:31 am »
Quote
Do you know when 1.3 will be released?
Never. Odd numbers are reserved for development versions. Releases 1.2.x are bugfix releases (no new features are added). Next new release with new features will be 1.4. No idea when it will come out.
See: http://wiki.freepascal.org/Lazarus_1.4.0_release_notes As you can see, new redesigned TEditButton is mentioned there.
Lazarus 2.1.0 r59757M FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.2, Plasma 5.14.2
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

AKCarlow

  • New member
  • *
  • Posts: 45
Re: TDateEdit Events problem
« Reply #4 on: August 08, 2014, 11:38:28 am »
Ah. You learn something every day (if you are not careful 8) ).

1.4 may well be out before I actually need that bit of code anyway, and I'm not going to work with development versions. At least with the stable release I first suspect that it is my problem, whereas with an "odd" version I would blame the tool!

Thank you again for your help.
Using: OS-X 10.6.8, Lazarus 1.2.4, FPC 2.6.4,  MySQL 5.6.19 (32-bit)