Autor Beitrag
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mo 06.12.04 22:40 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 if key = VK_RETURN then begin memo1.lines.add(edit1.Text); edit1.Text:='';end;
end;

wenn ich mit diesem code etwas abschicke, also die return taste drücken spielt windows immer so ein dämliches wav-file ab.
wie kann man das deaktivieren ?

das lästige geräusch das ich meine ist der Standardton Warnsignal (Windows XP-Ping.wav) von Windows.
sonderbar dass da ein warnsignal abgespielt werden muss :gruebel:

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
Moderiert von user profile iconChristian S.: Postings zusammengefasst
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Mo 06.12.04 22:47 
Vor das end; ein key := 0 einfügen.

Beim Weg: Man kann Posts editieren, besonders hilfreich ist das, wenn man fünf Minuten später noch was hinzuzufügen hat.

//edit: ich merk grad, das geht ja gar net... :? Aber sonst ging das doch so, oder? :gruebel:
//edit2: Ah jetzt, nimm das OnKeyPress Ereignis, anstelle von OnKeyDown!

_________________
JSXGraph
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 06.12.04 22:54 
2 Tipps:
[ironie]1. Kauf dir ne leisere Tastatur[/ironie]
2. Schalte die Multimedia Audio-Schemas von Windows ab.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
retnyg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Di 07.12.04 13:34 
Super raziel, mit dem code

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if key = #13 then begin memo1.lines.add(edit1.Text); edit1.Text:='';key:=#0;end;
end;


funktioniert es wie du sagst, weisst du aber auch woran es liegt :?:

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 07.12.04 13:38 
Weil dein Programm das <Enter> weiter schickt. Keine nimmt dann das Tastatur-Ereignis, also Warnung.
Durch den zusätzlichen Code, gilt das Tastatur-Ereignis als abgearbeitet.

Ich hoffe ich erinnere mich da richtig. :gruebel: