Autor Beitrag
Roy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: So 23.12.07 20:41 
Hallo Freunde,

wie sende ich die Enterfunktion an eine Button so dass ich den Buttonklick per Entertaste auslöse?

Danke
PeterPain
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83



BeitragVerfasst: So 23.12.07 20:54 
Das hängt davon ab welche komponente die message kriegt.

generell kannst du in deiner Form KeyPreview auf True setzen und dann im OnKeyPress bzw OnKeyDown das gewünschte Verhalten programmieren.

gruss
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: So 23.12.07 20:55 
Mit einem virtuellem Tastendruck die Taste vk_return (#13) drücken! Such einfach mal nach Suche in: Delphi-Forum, Delphi-Library KEYBD_EVENT

edit: Oh sorry, ich seh grad dass ich die Frage falsch verstanden habe.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 23.12.07 21:41 
Hallo!

Wenn Du bei einem Button die Default-Eigenschaft auf True setzt, wird er beim Betätigen der Enter-Taste "geklickt". Allerdings nicht, wenn Du z.B. in einem Memofeld bist, wo die Entertaste eine andere Bedeutung hat.

Grüße
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Mo 24.12.07 11:50 
Hao Christian,
Zufälligerweise befinde ich mich in einem Memofeld, kannst du mir sagen ob man dann einen Zusatzcode schreiben muss um die Funktion ENTER zu setzen?

Danke Roy
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19314
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 24.12.07 12:56 
Es gibt Ereignisse wie OnKeyDown, etc., auch bei einem Memo. Und dort kannst du auf das Drücken der Enter-Taste reagieren.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 24.12.07 14:30 
Hallo,

eine Alternative ist es auch Memo.WantReturnsauf False zu setzen.
Dann muss aber der Programm-Anwender [Strg] + [Enter] zur Erzeugung eines Zeilenumbruchs benutzen.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )