Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MT 1.5.0 Macro dialog size persistance #353

Closed
Tdue21 opened this issue Mar 21, 2019 · 4 comments
Closed

MT 1.5.0 Macro dialog size persistance #353

Tdue21 opened this issue Mar 21, 2019 · 4 comments
Assignees
Labels
bug tested This issue has been QA tested by someone other than the developer.

Comments

@Tdue21
Copy link
Contributor

Tdue21 commented Mar 21, 2019

The macro dialog only persists it current size when clicking the X on the title bar.
This does not make any sense, in my opinion.

The standard behavior, as far as I know, is that a window or dialog should only persist current size on OK.

@JamzTheMan
Copy link
Member

JamzTheMan commented Mar 21, 2019

+1

No technical reason this wasn't done, just default behavior and #time.

@Phergus Phergus added bug up for grabs Minimal context and are well-suited for new contributors labels Aug 23, 2019
@Phergus
Copy link
Contributor

Phergus commented Dec 26, 2019

@JamzTheMan - Looking at this and I see that the MacroButtonDialog class uses the WindowPreferences class to handle saving/restoring of window position preferences. The WindowPreferences class knows nothing about the why of the window closing and simply triggers off the window closing event. As far as I can tell there is no way for the WindowPreferences class to know that an "OK" button was pressed without assuming knowledge of the MacroButtonDialog class.

If the MacroButtonDialog class kept a reference to the WindowPreferences class and the storePreferences() method was public or there was a public method to set a flag for "saveOnClose" then it could be handled but that clearly breaks the whole intent of the design of WindowPreferences.

WindowPreferences only saves the prefs on the window closing event (Red X) and not the window closed events generated by the OK and Cancel buttons. So adding the windowClosing() method to WindowPreferences with a storePreferences() call would save when the OK button was pressed but also when Cancel was pressed.

Hopefully I'm missing something simple here.

@emmebi
Copy link
Collaborator

emmebi commented Jan 19, 2020

I am looking into this. The implementation of the fix seems straightforward: as @Phergus mentioned, it looks like we need to a WindowClosed handler which duplicates the work done by the WindowClosing handler. I have tested this and it seems to work.

emmebi added a commit to emmebi/maptool that referenced this issue Jan 19, 2020
- adds the windowClosed event
- adds a couple of unit tests

Fixes RPTools#353
@Phergus Phergus removed the up for grabs Minimal context and are well-suited for new contributors label Jan 19, 2020
@Phergus Phergus changed the title [BUG] MT 1.5.0 Macro dialog size persistance MT 1.5.0 Macro dialog size persistance Jan 19, 2020
@Phergus
Copy link
Contributor

Phergus commented Jan 19, 2020

Tested. Window size is saved on any close action.

@Phergus Phergus added the tested This issue has been QA tested by someone other than the developer. label Jan 21, 2020
Phergus added a commit that referenced this issue Jan 21, 2020
@Phergus Phergus closed this as completed Jan 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug tested This issue has been QA tested by someone other than the developer.
Projects
None yet
Development

No branches or pull requests

4 participants