Autor Beitrag
Ares
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 128



BeitragVerfasst: Mo 19.07.04 16:35 
Hallo!

Ich würde gerne bei einem Klick auf ein TImage eine Aktion nur dann ausführen, wenn gleichzeitig eine Bestimmte Tastenkombination, z.B. Strg+Alt+Q, gedrückt wurde. Wie kann ich das abfragen?

Besten Dank
Ares
Viper
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 88



BeitragVerfasst: Mo 19.07.04 17:19 
Erstmal setzt du die Eigenschaft KeyPreview deines Formulars auf 'True'.
Und dann benutzt du einfach das Ereignis OnKeyDown deines Formulars:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TFormAnimate.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if ( ssCtrl in Shift ) and ( ssAlt in Shift ) and (Key = Word('Q') ) then
  begin
    //hier das rein was geschehen soll
  end;
end;

_________________
"Der Sinussatz ist nur was für Leute, die Teichbesitzer mit Insel und Baum sind. Alle anderen können ihn vergessen" (Mein Mathe-Prof.)
Ares Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 128



BeitragVerfasst: Mo 19.07.04 18:02 
Hallo!

Danke für die rasche Antwort! Das Ereignis wird jetzt bei jedem Tastendruck ausgelöst, und es passiert nur was, wenn genau die 3 Tasten gedrück sind.
Soweit so gut...

Aber wei kann ich das nun noch mit dem Click auf das Image verbinden? Beim OnClick vom Image gibt es die Parameter Shift und Key ja leider nicht...

Danke
Ares
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Mo 19.07.04 18:09 
Ares hat folgendes geschrieben:
Aber wei kann ich das nun noch mit dem Click auf das Image verbinden? Beim OnClick vom Image gibt es die Parameter Shift und Key ja leider nicht...

Suche in: Delphi-Forum, Delphi-Library GETKEYSTATE und Suche in: Delphi-Forum, Delphi-Library GETKEYBOARDSTATE

raziel

_________________
JSXGraph