Discussion:
TMonthCalendar
(too old to reply)
Stark
2010-05-30 13:06:09 UTC
Permalink
I had in mind to let the user doubleclick on a date of the calendar to
create a todo item with that date as an expiry date, but I found that the
doubleclick fires whereever I click on the control, even changing month...
Also the single click has the same behaviour. How can I do what I had in
mind ?
a***@aol.com
2010-05-30 15:07:19 UTC
Permalink
Post by Stark
I had in mind to let the user doubleclick on a date of the calendar to
create a todo item with that date as an expiry date, but I found that the
doubleclick fires whereever I click on the control, even changing month...
Also the single click has the same behaviour. How can I do what I had in
mind ?
MyDateTimePicker.Date in OnChange.

As . . .

procedure TForm1.DateTimePicker1Change(Sender: TObject);
begin
Label1.Caption := DateToStr(TDateTimePicker(Sender).Date);
end;

Alan Lloyd
Stark
2010-05-30 21:55:50 UTC
Permalink
Post by a***@aol.com
Post by Stark
I had in mind to let the user doubleclick on a date of the calendar to
create a todo item with that date as an expiry date, but I found that the
doubleclick fires whereever I click on the control, even changing month...
Also the single click has the same behaviour. How can I do what I had in
mind ?
MyDateTimePicker.Date in OnChange.
As . . .
procedure TForm1.DateTimePicker1Change(Sender: TObject);
begin
Label1.Caption := DateToStr(TDateTimePicker(Sender).Date);
end;
Alan Lloyd
Sorry, I don't understand. I have a TMonthCalendar and not a
TDateTimePicker. Please explain your suggestion.You mean I should use a
TDateTimePicker instead ?
a***@aol.com
2010-05-31 09:47:39 UTC
Permalink
Sorry, �I don't understand. I have a TMonthCalendar and not a
TDateTimePicker. Please explain your suggestion.You mean I should use a
TDateTimePicker instead ?- Hide quoted text -
Sorry - I didn't notice that. But it works just the same . . .

procedure TForm1.MonthCalendar1Click(Sender: TObject);
begin
Label1.Caption := DateToStr(TMonthCalendar(Sender).Date);
end;

Look up TMonthCalendar in Delphi Help, & investigate its ptoperties &
events

Alan Lloyd
Stark
2010-05-31 16:29:40 UTC
Permalink
Sorry, �I don't understand. I have a TMonthCalendar and not a
TDateTimePicker. Please explain your suggestion.You mean I should use a
TDateTimePicker instead ?- Hide quoted text -
Sorry - I didn't notice that. But it works just the same . . .

procedure TForm1.MonthCalendar1Click(Sender: TObject);
begin
Label1.Caption := DateToStr(TMonthCalendar(Sender).Date);
end;

Look up TMonthCalendar in Delphi Help, & investigate its ptoperties &
events

Alan Lloyd

I did that (investigating properties..) and found that a click or a double
click fires the relevant event WHEREVER you click the mouse within the
boundaries of the TMonthControl. This behaviour defeats the purpose I had in
mind: letting the user double click on a date to do something.. this works
correctly and the relevant procedure is executed, but this same procedure is
executed if the user clicks outside a date. THIS IS THE PROBLEM!
Sorry I have some difficulties in making myself understood..
Stark
2010-05-31 22:39:02 UTC
Permalink
Post by a***@aol.com
Sorry, �I don't understand. I have a TMonthCalendar and not a
TDateTimePicker. Please explain your suggestion.You mean I should use a
TDateTimePicker instead ?- Hide quoted text -
Sorry - I didn't notice that. But it works just the same . . .
procedure TForm1.MonthCalendar1Click(Sender: TObject);
begin
Label1.Caption := DateToStr(TMonthCalendar(Sender).Date);
end;
Look up TMonthCalendar in Delphi Help, & investigate its ptoperties &
events
Alan Lloyd
I did that (investigating properties..) and found that a click or a double
click fires the relevant event WHEREVER you click the mouse within the
boundaries of the TMonthControl. This behaviour defeats the purpose I had
in mind: letting the user double click on a date to do something.. this
works correctly and the relevant procedure is executed, but this same
procedure is executed if the user clicks outside a date. THIS IS THE
PROBLEM!
Sorry I have some difficulties in making myself understood..
May be there a way to discern the click not done on a date looking at the
mouse coordinates..?
Jamie
2010-05-31 22:45:18 UTC
Permalink
Post by Stark
Post by a***@aol.com
Sorry, �I don't understand. I have a TMonthCalendar and not a
TDateTimePicker. Please explain your suggestion.You mean I should use a
TDateTimePicker instead ?- Hide quoted text -
Sorry - I didn't notice that. But it works just the same . . .
procedure TForm1.MonthCalendar1Click(Sender: TObject);
begin
Label1.Caption := DateToStr(TMonthCalendar(Sender).Date);
end;
Look up TMonthCalendar in Delphi Help, & investigate its ptoperties &
events
Alan Lloyd
I did that (investigating properties..) and found that a click or a
double click fires the relevant event WHEREVER you click the mouse
within the boundaries of the TMonthControl. This behaviour defeats the
purpose I had in mind: letting the user double click on a date to do
something.. this works correctly and the relevant procedure is
executed, but this same procedure is executed if the user clicks
outside a date. THIS IS THE PROBLEM!
Sorry I have some difficulties in making myself understood..
May be there a way to discern the click not done on a date looking at
the mouse coordinates..?
Or just subclass it and override the button clicks..

Loading...