AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Key = '*' -> Edit1.Text = Akt. Datum

Ein Thema von Nalincah · begonnen am 9. Aug 2004 · letzter Beitrag vom 9. Aug 2004
Antwort Antwort
Benutzerbild von Nalincah
Nalincah

Registriert seit: 18. Jul 2003
898 Beiträge
 
Delphi 6 Professional
 
#1

Key = '*' -> Edit1.Text = Akt. Datum

  Alt 9. Aug 2004, 14:40
Ich hab ein Edit-Feld. Wenn man '*' drückt soll das aktuelle Datum reingeschrieben werden

Delphi-Quellcode:
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;
Leider steht hier aber "*09.08.2004". Wie kann ich das "*" rauskriegen?
Sebastian
Ehemals bekannt als General2004
  Mit Zitat antworten Zitat
Benutzerbild von Sharky
Sharky

Registriert seit: 29. Mai 2002
Ort: Frankfurt
8.251 Beiträge
 
Delphi 2006 Professional
 
#2

Re: Key = '*' -> Edit1.Text = Akt. Datum

  Alt 9. Aug 2004, 14:47
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;
Stephan B.
"Lasst den Gänsen ihre Füßchen"
  Mit Zitat antworten Zitat
beny_fritz

Registriert seit: 9. Aug 2004
1 Beiträge
 
#3

Re: Key = '*' -> Edit1.Text = Akt. Datum

  Alt 9. Aug 2004, 14:47
Hi,
Irgendwie bisch im Falschen Event und hasch den Falschen ASCII-Code.
So geht's:



Delphi-Quellcode:
procedure TForm1.EditBisDatumKeyPress(Sender: TObject; var Key: Char);
begin
  case key of
    #42 : begin
            key := #0;
            TEdit(Sender).Text := DateToStr(Date);
          end;
  end;
end;
Gruss Beny
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:48 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz