AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Navigation mit Pfeiltasten

Ein Thema von dm007 · begonnen am 19. Sep 2006 · letzter Beitrag vom 22. Sep 2006
 
Benutzerbild von DGL-luke
DGL-luke

Registriert seit: 1. Apr 2005
Ort: Bad Tölz
4.149 Beiträge
 
Delphi 2006 Professional
 
#13

Re: Navigation mit Pfeiltasten

  Alt 20. Sep 2006, 16:22
generisch, das wort heißt generisch!

Delphi-Quellcode:
var ControlIndex: Integer; //global, am besten mit 0 initialisieren

procedure TForm1.KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
var Controls: array of TControl;
begin
if not ((Key = VK_LEFT) or (Key = VK_RIGHT)) then
  Exit; //wir wollen ja nicht alles abwürgen

//die zuweisung sollte man natürlich auch global machen
Setlength(Controls,4);
Controls[0] := Btn1;
Controls[1] := Btn2;
Controls[2] := Btn3;
Controls[3] := Btn4;

case Key of
  VK_RIGHT: Inc(ControlIndex);
  VK_LEFT: Dec(ControlIndex);
end;

if ControlIndex < low(Controls) then
  ControlIndex := high(Controls)
else if ControlIndex > high(Controls) then
  ControlIndex := low(Controls);

ActiveControl := Controls[ControlIndex];
end;


[edit=SirThornberry]Quelltext auf Wunsch korrigiert - Mfg, SirThornberry[/edit]
Lukas Erlacher
Suche Grafiktablett. Spenden/Gebrauchtangebote willkommen.
Gotteskrieger gesucht!
For it is the chief characteristic of the religion of science that it works. - Isaac Asimov, Foundation I, Buch 1
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:30 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz