Procedure TForm1.FormKeyDown(Sender: TObject; Var Key: Word;
Shift: TShiftState);
Begin
// SCREEN WIDTH
If (Key = Ord('W')) And (ssShift In Shift)
Then SetBounds(0, Top, (Screen.WorkAreaWidth-14), Height);
// STANDARD WIDTH
If (Key = Ord('W')) And (ssCtrl In Shift)
Then SetBounds((Screen.WorkAreaWidth -Self.Width) Div 2,
(Screen.WorkAreaHeight-Self.Height) Div 2,
500, 500);
End;
If I move the window to different positions on the screen and press "CTRL + W", then it appears in the middle of the screen as expected.
But if I use "SHIFT + W" first and after that "CTRL + W", then the window appears not in the middle of the screen.
The same if I maximize the window or if I dock the window to the left or right side of the screen and press "CTRL + W".
If I press "CTRL + W" a second time then it's working correct.
Obviously I miss something here ! ??? Why is it sometimes working and sometimes not?