Autor Beitrag
1012178 Threadstarter
Hält's aus hier
Beiträge: 12



BeitragVerfasst: Mi 23.10.02 18:42 
Muss ich dann auch nochmal irgendwo was einstellen, habe mal die Taste S genommen, also #53, da passiert, wer hätte es gedacht, nichts. Wenn ich auf enter drücke, dann kommt immer ne 1, weil wohl der button"eins" so gestrichelt eingerahmt ist.
aogwaba
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 109



BeitragVerfasst: Mi 23.10.02 19:36 
Hi!

so kannst du testen ob 's' gedrückt wurde:
ausblenden Quelltext
1:
if (key='s') or (key='S') then...					

cu
waba
1012178 Threadstarter
Hält's aus hier
Beiträge: 12



BeitragVerfasst: Mi 23.10.02 19:40 
Das "S" habe ich nur zu testzwecken benutzt. ich brauche noch die Enter, backspace und entf taste, aber mit der nummer das geht net. :(
aogwaba
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 109



BeitragVerfasst: Mi 23.10.02 19:44 
was geht nicht?
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 23.10.02 20:04 
Hi!

Ich glaube, ich weiß, wo Dein Problem liegt: wenn z.B. Button1 ausgewählt ist und die Enter-Taste gedrückt wird, so wird dies nicht als OnKeyPress der Form gewertet (selbst wenn KeyPreview = true ist!), sondern als Betätigen dieses Buttons.

Wie man das beheben kann, weiß ich auch nicht.

MfG,
Peter

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



BeitragVerfasst: Mi 23.10.02 20:44 
Hi Peter Lustig!

Aber ist das nicht normal, wenn der Button den Focus hat, und 'Enter' gedrückt wird, wird ja die richtige Procedure ausgeführt.
Oder hab ich was übersehen?

cu
waba
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 23.10.02 21:22 
Ich glaube, er meint das so:

Button1 ist ausgewählt. Wenn Enter gedrückt wird, soll aber Button2.Click ausgeführt werden.

Das klappt dann nicht. Selbst wenn Button2.Default=True und Form1.KeyPreView=true gilt.

MfG,
Peter

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


D6 Pers, TP 7.0
BeitragVerfasst: Do 24.10.02 18:49 
Erst mal entschuldigung :oops: .
a) Du kannst die Form1 mit Form1.setFocus anvisieren
b) Schau mal ob die Property Default vom EinsButton true ist, wenn ja wird er jedes mal betätigt, wenn du enter drückst
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 24.10.02 21:58 
wieczo hat folgendes geschrieben:
Schau mal ob die Property Default vom EinsButton true ist, wenn ja wird er jedes mal betätigt, wenn du enter drückst

Wie ich schon in meinem vorigen Posting geschrieben habe, klappt das nicht. Wenn Button1 den Fokus hat, Button2.Default=true ist, wird Button1 ausgeführt, wenn Enter gedrückt wird. Habe es gerade noch einmal bei mir ausprobiert.

Die Hilfe schreibt dazu folgendes:
Delphi-Hilfe hat folgendes geschrieben:
...any button that has focus becomes the Default button temporarily...


MfG,
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Fr 01.11.02 14:21 
Hallo,

nur um die möglichkeiten noch einmal zu erweitern.
Es ist problemlos möglich das mit einer ActionList zu verwirklichen. Einfach eine Action ankegen und als Shortcut die 1 angeben.
Genaueres hier.

Gruß
Klabautermann