Recent

Author Topic: TDateTimePicker  (Read 1224 times)

roamer57

  • Newbie
  • Posts: 1
TDateTimePicker
« on: March 02, 2022, 04:12:01 pm »
Hi, I am on a MacBook Pro M1 an have big problem with TDateTimePicker. I have followed this tutorial https://www.youtube.com/watch?v=aQQDxaHdf98

I have a DateTimePicker and a Edit box and a Memo box and a button. I typ some in the edit box and then choose a date with the DateTimePicker and push the button then the selected date and the text in the edit box should be added in the memo.

procedure TForm1.Button1Click(Sender: TObject);
begin
  Memo1.Lines.Add(DateToStr(DateTimePicker1.Date) + ' - '  +  Edit1.Text);
end;

The problem I have it that when select a date in the popup calendar from the DateTimePicker it only shows the current date + the text regardless what date I select with the picker. I need some help here.
Regards roamerP57
« Last Edit: March 03, 2022, 10:25:54 am by roamer57 »

Xatrix

  • New Member
  • *
  • Posts: 15
Re: TDateTimePicker
« Reply #1 on: March 08, 2022, 08:36:03 pm »
Events -> OnChange

procedure TForm1.DateTimePicker1Change(Sender: TObject);
begin
   edit1.text := DateTimeToStr(DateTimePicker1.DateTime);
end;   

Zoran

  • Hero Member
  • *****
  • Posts: 1949
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: TDateTimePicker
« Reply #2 on: March 08, 2022, 09:54:46 pm »
I am not sure I understand what the problem is.
Would you please upload an application, as simple as possible, which demonstrates the problem.
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

 

TinyPortal © 2005-2018