Recent

Author Topic: MaskEdit is jumpy  (Read 3126 times)

Middlecope

  • Jr. Member
  • **
  • Posts: 59
Re: MaskEdit is jumpy
« Reply #15 on: September 28, 2018, 05:30:44 pm »
I did not know of the the existence of TDateEdit.  Yes ithat works well.
I added a KeyUp event to make sure only numbers are entered:
Code: Pascal  [Select]
  1. procedure TForm8.DateEdit1KeyUp(Sender: TObject; var Key: Word;
  2.   Shift: TShiftState);
  3. begin
  4. // excluding the entry of date separators "-" and "/"
  5. IF Key IN [189,191] THEN BEGIN
  6. DateEdit1.Text:= Copy(DateEdit1.Text,1,Length(DateEdit1.Text)-1);
  7. DateEdit1.Selstart:= Length(DateEdit1.Text) END;
  8. //placing the date separator "-"
  9.   IF (Length(DateEdit1.Text) IN [2,5]) THEN BEGIN
  10.      DateEdit1.Text:= DateEdit1.Text + '-';
  11. DateEdit1.SelStart:= Length(DateEdit1.Text) +1 END;
  12. end;
Thanks for the advice and for me the topic is solved,
Teunis