Changed my code to this:
//Focus von anderen Componenten nehmen
KeyPreview:= True;
case Key of
VK_UP: if (ssShift in Shift) then MoveWholeUnit(dirBackward) else MoveWholeUnit(dirUp);
VK_DOWN: if (ssShift in Shift) then MoveWholeUnit(dirForward) else MoveWholeUnit(dirDown);
VK_LEFT: MoveWholeUnit(dirLeft);
VK_RIGHT: MoveWholeUnit(dirRight);
end;
Key:= 0;
KeyPreview:= False;
Now it does the Exact opposite of what i wanted to have
Sorry for the Useless Description last time just thought i have the Code like u explained and it didn't work .. even with all settings.
EDIT: I obviously placed "KeyPreview:= True;" wrong ... where should i put it ? if i put it at start it wont allow me to Press any Key.
EDIT2: Deleted every keyPreview. But now i cant press anything (Key := 0 was the Problem). Still don't know how to use Keypreview
EDIT3: This did the Job :
procedure TStartUp.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
//Focus von anderen Componenten nehmen
case Key of
VK_UP: if (ssShift in Shift) then MoveWholeUnit(dirBackward) else MoveWholeUnit(dirUp);
VK_DOWN: if (ssShift in Shift) then MoveWholeUnit(dirForward) else MoveWholeUnit(dirDown);
VK_LEFT: MoveWholeUnit(dirLeft);
VK_RIGHT: MoveWholeUnit(dirRight);
end;
case Key of
VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT: Key:= 0;
end;
end;
EDIT4: Ok no it didn't. It Helped me to move Object without Problems but took my possibility to use Arrow Keys in generall
EDIT5: All i acheived were Some workarounds wich do NOT do what i wanted but get Close to it.
procedure TStartUp.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If CbDeviceType.Focused then begin
RemoveFocus(True);
Exit;
end;
//Focus von anderen Componenten nehmen
case Key of
VK_UP: if (ssShift in Shift) then MoveWholeUnit(dirBackward) else MoveWholeUnit(dirUp);
VK_DOWN: if (ssShift in Shift) then MoveWholeUnit(dirForward) else MoveWholeUnit(dirDown);
VK_LEFT: MoveWholeUnit(dirLeft);
VK_RIGHT: MoveWholeUnit(dirRight);
end;
//Dies soll davon abhalten dass nebenbei ComboBoxen ihren Wert ändern
case Key of
VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT: Key:= 0;
end;
end;