Recent

Author Topic: TCalendar View disconnect with datetime  (Read 314 times)

alvas

  • New Member
  • *
  • Posts: 10
TCalendar View disconnect with datetime
« on: January 22, 2025, 06:05:43 am »
Hi, I have created a dialog with two TCalendar components so I can select & from & to date as I don't believe there is a from & to date calendar available.  I have two issues which I cannot work out.  Here is my code:

Code: Pascal  [Select][+][-]
  1. procedure TfCalendarDlg.ShowDateRangeDialog(var FromDate, ToDate: TDate);
  2. var
  3.    Dialog: TfCalendarDlg;
  4. begin
  5.    Dialog := TfCalendarDlg.Create(nil);
  6.    try
  7.       calFrom.DateTime := FromDate;
  8.       calTo.DateTime := ToDate;
  9.       if Dialog.ShowModal = mrOk then begin
  10.         FromDate := calFrom.DateTime;
  11.         ToDate := calTo.DateTime;
  12.       end;
  13.    finally
  14.       Dialog.Free;
  15.    end;
  16. end;
  17.  

1. when I assign a from date to to the first calendar and a to date to the second, this does not reflect on-screen.  The selected day should be highlighted (lines 7,8)

2. when I select a new day at runtime on the calendar it does not reflect the chosen date in the datetime property (lines 10,11), it is still set to the original dates (lines 7,8).

It's as if the control is disconnected from the DateTime property.  Any clues? Thank you.

TRon

  • Hero Member
  • *****
  • Posts: 3946
Re: TCalendar View disconnect with datetime
« Reply #1 on: January 22, 2025, 06:25:54 am »
Pardon my ignorance but do I really see that inside your dialog form you are creating that same dialog form ?
I do not have to remember anything anymore thanks to total-recall.

 

TinyPortal © 2005-2018