Hola.
Este ejemplo cambia la leyenda y color del Label actualmente seleccionado como pides:
Código Delphi
[-]
...
implementation {$R *.dfm}
var
vLbs: array of TLabel;
inx : Integer = 0;
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
begin
for i := 0 to Self.ComponentCount-1 do
if Self.Components[i] is TLabel then
begin
SetLength(vLbs, Length(vLbs)+1);
vLbs[High(vLbs)] := TLabel(Components[i]);
end;
TLabel(vLbs[Low(vLbs)]).Font.Color := clLime;
TLabel(vLbs[Low(vLbs)]).Caption := TLabel(vLbs[Low(vLbs)]).Caption + ' Color verde';
for i := Low(vLbs)+1 to High(vLbs) do
begin
TLabel(vLbs[i]).Font.Color := clYellow;
TLabel(vLbs[i]).Caption := TLabel(vLbs[i]).Caption + ' Color amarillo';
end;
Self.KeyPreview := True;
end;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
TLabel(vLbs[inx]).Caption := Copy( TLabel(vLbs[inx]).Caption,1,
Pos(' Color', TLabel(vLbs[inx]).Caption) ) + 'Color amarillo';
TLabel(vLbs[inx]).Font.Color := clYellow;
case Key of
VK_DOWN: if inx < High(vLbs) then
Inc(inx)
else
Inx := Low(vLbs);
VK_UP : if inx > Low(vLbs) then
Dec(inx)
else
Inx := High(vLbs);
end;
TLabel(vLbs[inx]).Caption := Copy( TLabel(vLbs[inx]).Caption,1,
Pos(' Color', TLabel(vLbs[inx]).Caption) ) + 'Color verde';
TLabel(vLbs[inx]).Font.Color := clLime;
end;
El comportamiento es cíclico, es decir que si estas en el Label inferior y continuas presionando la tecla Down regresa al superior y viceversa con la tecla Up.
Muestra:
Saludos