Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

TLMDDBDateTimePicker question

i have a question about this component.
Is there a way to cancel the date? I mean, not when you have just selected the date, but when you want, for example, to blank a date that was already saved in the connected field.
I tried to press cancel or delete but nothing happens.
Thank you.


  • 6 Comments sorted by Votes Date Added
  • There no such possibility. If something is stored in db-field, you can canel editing only for the whole row.
  • Maybe i didn't explain well.
    I made this video where you can see the problem.

    At the beginning of the video i use the combobox and the dbdatetimepicker (there is an error in the videorecording, you cannot see the drop down menu but it is working correctly)
    Then i save my data, and i try to blink the fields that i've filled before. In the combobox I press "Canc" and the data disappear, on the contrary in the datetimepicker i am not able to delete the data. I've tried to press canc, backspace etc, but nothing works.
  • What is "I press Canc"? If you just want to beable to empty data field by pressing Escape, Backspace, ect, you can do this by writing OnKeyDown event handler and clearing the corresponding data field value directly in data-set.
  • Hi,

    I tried to write this event:

    procedure TfrmAnaEmittenti.dtpDataFatKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
      if (Key = VK_DELETE) or (Key = VK_BACK) then
        dtpDataFat.Text := '';
        dtpDataFat.Field.Value := Null;

    After this event, the text visible in dtpDataFat (TLMDDBDateTimePicker) is Today date.
    What am I doing wrong?


  • The following code works (you should add Key := 0 to prevent futher default processing):

    procedure TForm2.LMDDBDateTimePicker1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
      if (Key = VK_DELETE) then
        Key := 0;
  • Thank you, now it works.

Sign In or Register to comment.