Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

HelpWindow: help window stays open even after exiting by clicking the close button #826

Closed
vivekscl opened this issue Feb 11, 2018 · 6 comments · Fixed by #832
Closed

HelpWindow: help window stays open even after exiting by clicking the close button #826

vivekscl opened this issue Feb 11, 2018 · 6 comments · Fixed by #832

Comments

@vivekscl
Copy link
Contributor

vivekscl commented Feb 11, 2018

This should not be the case as closing the app should close every other window related to it.

Edit: Likely to happen on certain operating systems only. So far, it seems to be happening on Linux.

@vivekscl vivekscl changed the title HelpWindow: help window stays open even after exiting HelpWindow: when in full screen mode, help window stays open even after exiting Feb 11, 2018
@Zhiyuan-Amos
Copy link
Contributor

On MacOS: When both the application & Help Window are full screen, executing ExitCommand closes both the application & Help Window.

@yamgent
Copy link
Member

yamgent commented Feb 12, 2018

I cannot reproduce this bug on Windows 10.

@yamgent
Copy link
Member

yamgent commented Feb 12, 2018

I just tried it out on Linux and didn't face any issue... can you tell us what you did step by step? :P

I was able get the HelpWindow closed if I do the following:

  1. Use the Help menu to open HelpWindow (this is to circumvent the bug in HelpWindow: May interfere with UI Components while active #727).
  2. Ensure that both windows are full-screened.
  3. Execute exit.

@vivekscl
Copy link
Contributor Author

vivekscl commented Feb 12, 2018

Typing exit does close the HelpWindow automatically.
The steps to reproduce the error is the following:

  1. Use any method to open the HelpWindow
  2. Ensure both screens are full-screened
  3. And then close the app using the x button at the top right-hand corner

Edit: Here's the GIF,

gif

@yamidark
Copy link
Contributor

I'm able to reproduce the bug on Windows 10 though:

  • open help window through any methods, click the close button, help window stays.
  • open help window through F1 or menu button, then executing exit will close the help window.
  • open help window through help, calling exit does not even close the app, until the help window is closed.

@yamgent
Copy link
Member

yamgent commented Feb 13, 2018

Typing exit does close the HelpWindow automatically.
The steps to reproduce the error is the following:

  1. Use any method to open the HelpWindow
  2. Ensure both screens are full-screened
  3. And then close the app using the x button at the top right-hand corner

Ah okay, I can now reproduce this issue. In fact, you don't even need the screen to be full in order to reproduce this bug.

I took a quick look at the codebase, and I think the reason is because MainWindow is not associated with HelpWindow in any way, so closing MainWindow will not affect HelpWindow (the exit command does not have this issue because it closes the entire application, rather than just MainWindow).

I see two different possible ways of solving this:

  1. Just make MainWindow call MainWindow#handleExit when closing the window, so that the effect is same as executing ExitCommand, or
  2. Associate MainWindow with HelpWindow, by setting MainWindow as HelpWindow's owner. I.e. (Note the code is not perfect, and it introduces an annoying behaviour that makes HelpWindow not selectable on the taskbar).
diff --git a/src/main/java/seedu/address/ui/MainWindow.java b/src/main/java/seedu/address/ui/MainWindow.java
index 20ad5fee..ce5f29c4 100644
--- a/src/main/java/seedu/address/ui/MainWindow.java
+++ b/src/main/java/seedu/address/ui/MainWindow.java
@@ -166,6 +166,7 @@ public class MainWindow extends UiPart<Stage> {
     @FXML
     public void handleHelp() {
         HelpWindow helpWindow = new HelpWindow();
+        helpWindow.getRoot().initOwner(this.getRoot()); // note: on Windows, HelpWindow is not visible on the taskbar.
         helpWindow.show();
     }

@vivekscl vivekscl changed the title HelpWindow: when in full screen mode, help window stays open even after exiting HelpWindow: help window stays open even after exiting by clicking close button Feb 13, 2018
@vivekscl vivekscl changed the title HelpWindow: help window stays open even after exiting by clicking close button HelpWindow: help window stays open even after exiting by clicking the close button Feb 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants