Recent

Author Topic: How To Use the TDateEdit Control  (Read 3854 times)

gkelby

  • New Member
  • *
  • Posts: 24
How To Use the TDateEdit Control
« on: April 16, 2014, 10:22:13 am »
Hello:

I have a very simple question.  I have a TDateEdit control on the form that I populate from a DB table.. I want to let the user change the date.  On the form the user can activate up the calendar selection box/function and select a new date.  How do I then pick up that new date and place it in the control on the form?  I there a function, procedure or property I can use to pick up the new selected date?

I am using:
Lazarus version 1.1.99pre-release, FPC version 2.6.2, SVN version 42829, i386-win32-win32/win64
SQLite3 and Windows 7 Ultimate 64.

Thanks...
GK

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: How To Use the TDateEdit Control
« Reply #1 on: April 16, 2014, 10:57:12 am »
TDateEdit has a .Date property.  Just read that...

There's also a TDBDateEdit control.  Personally I don't use the TDBxxx range of controls - I prefer having full control, but you may find it meets your needs...

EDIT:  I do apologize.  There isn't a TDBDateEdit in the default lazarus palette.  There's a TDBCalendar, but this offers a different UI experience to what I'd expect from a TDBDateTime.  So, best pretend I never said anything about TDBDateEdit, just stick to reading and writing the .Date property of the TDateEdit control...
« Last Edit: April 16, 2014, 11:08:26 am by Mike.Cornflake »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

itsols

  • New Member
  • *
  • Posts: 27
    • Marha Online (Pvt) Ltd
Re: How To Use the TDateEdit Control
« Reply #2 on: April 17, 2014, 02:03:59 pm »
The Date property is the key item you must use. Here's an example:

Code: [Select]
AppointmentDate.Date := Date;
The above line puts the CURRENT SYSTEM DATE in the date box.

Another key property that I set is the DateOrder. You can set this from the Property Window at Design Time. I often use the format doDMY as it's how we work with dates.
My favourites: PHP (LAMP), C/C++ (GCC), VB, Pascal and now Lazarus

 

TinyPortal © 2005-2018