Autor Beitrag
manta656
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 18



BeitragVerfasst: So 22.02.09 12:49 
Hallo , ich möchte dass wen man in Edit1 die Entertaste drückt , dan der SpeedButton aktiviert wird also so :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key = 13 SpeedButton1.Click();
end;


Jedoch sagt er mir immer , dass da ein fehler ist. wie kan ich die funktion aktivieren ?
uko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 220
Erhaltene Danke: 1

Win XP, VISTA, WIndows 7
Delphi 2007/2010 Prof
BeitragVerfasst: So 22.02.09 13:15 
Hallo,

lies doch mal die Fehlermeldung genau! Delphi zeigt einem ja die Stelle an, wo es meckert :-)

Lösung: Key = chr(13) oder Ord(Key) = VK_RETURN


Grüße,
Uli
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19336
Erhaltene Danke: 1751

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 22.02.09 13:16 
Außerdem fehlt da ein then:
ausblenden Delphi-Quelltext
1:
2:
if Key = #13 then
  ...
manta656 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 18



BeitragVerfasst: So 22.02.09 14:47 
ja danke :D hier nochmal für die , die es mit den Erklärungen nicht verstanden haben ^^

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then SpeedButton1.Click();
end;


p.s. hat jemand ne lösung , wie ich im Webbrowser also im TWebBrowser , Enter benutzen kan ?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19336
Erhaltene Danke: 1751

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 22.02.09 14:51 
user profile iconmanta656 hat folgendes geschrieben Zum zitierten Posting springen:
p.s. hat jemand ne lösung , wie ich im Webbrowser also im TWebBrowser , Enter benutzen kan ?
Schau mal da, ich schätze Enter ist das selbe Problem: ;-)
www.delphi-forum.de/viewtopic.php?p=546767
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 22.02.09 15:17 
Ich würde übrigens den Code der Schaltfläche in eine sepaarte Routine auslagern oder zumindest der Schaltfläch einen aussagekräftigen Namen geben.
manta656 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 18



BeitragVerfasst: So 22.02.09 15:19 
ja ich weiss , ich geben jeder Sache ja einen Name ;) ist aber leichter so zu verstehen , dass es sich um Edit1 handelt ^^ und das mit der 'Entertaste' Danke , ich werde es versuchen