![]() |
Key = '*' -> Edit1.Text = Akt. Datum
Ich hab ein Edit-Feld. Wenn man '*' drückt soll das aktuelle Datum reingeschrieben werden
Delphi-Quellcode:
Leider steht hier aber "*09.08.2004". Wie kann ich das "*" rauskriegen?
procedure TForm1.EditBisDatumKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin case key of 106 : begin key := 0; TEdit(Sender).Text := DateToStr(Date); end; end; end; |
Re: Key = '*' -> Edit1.Text = Akt. Datum
Hai General,
versuche es mal so im OnKeyPress:
Delphi-Quellcode:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin if (Key = '*') then begin Key := #0; TEdit(Sender).Text := DateToStr(Date); end; end; |
Re: Key = '*' -> Edit1.Text = Akt. Datum
Hi,
Irgendwie bisch im Falschen Event und hasch den Falschen ASCII-Code. So geht's:
Delphi-Quellcode:
Gruss Beny
procedure TForm1.EditBisDatumKeyPress(Sender: TObject; var Key: Char);
begin case key of #42 : begin key := #0; TEdit(Sender).Text := DateToStr(Date); end; end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:17 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz