/// <summary> /// 押されたキーに応じてフォーカスの移動を試みます。 /// </summary> void MoveFocus() { if (Screen.FocusedControl == null) { return; } var focusScope = FocusScope.GetFocusScope(Screen.FocusedControl); if (focusScope == null) { return; } if (Screen.KeyboardDevice.IsKeyPressed(Keys.Up)) { focusScope.MoveFocus(FocusNavigationDirection.Up); } else if (Screen.KeyboardDevice.IsKeyPressed(Keys.Down)) { focusScope.MoveFocus(FocusNavigationDirection.Down); } else if (Screen.KeyboardDevice.IsKeyPressed(Keys.Left)) { focusScope.MoveFocus(FocusNavigationDirection.Left); } else if (Screen.KeyboardDevice.IsKeyPressed(Keys.Right)) { focusScope.MoveFocus(FocusNavigationDirection.Right); } }
/// <summary> /// コンストラクタ。 /// </summary> /// <param name="screen">Screen。</param> public Window(Screen screen) : base(screen) { FocusScope = new FocusScope(this); Activatable = true; // Window は表示されるまで Visible = false です。 Visible = false; }