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

Stop splitters from migrating between sessions #2598

Merged
merged 1 commit into from
Dec 12, 2018

Conversation

HebaruSan
Copy link
Member

Problem

If you close and re-open GUI, the splitters between the mod list and the mod info and between the mod name/description and the mod info tabs are supposed to retain their positions. However, currently they tend to migrate rightwards and downwards rather than staying the same.

For example, across several open/close cycles where I did nothing but exit CKAN, the ModInfoPosition property in GUIConfig.xml took on this sequence of values:

292, 569, 891, 891, 891

Closing this window:

image

... results in this window at the next launch:

image

Cause

Forms raise events in the following order at launch:

  1. Load
  2. Activated
  3. Shown

In a typical WinForms application, a form has a hard coded layout of a static size set at design time, which is then modified to fit other window sizes. To handle this, the various container controls have their layouts recalculated to fit the actual size of the window. This happens after Load and before Shown.

Currently CKAN restores the positions of its splitters in Load, before the container layouts are recalculated. This means that the saved positions are used as inputs into the recalculation process rather than absolute positions. When the layout is recalculated, different splitter positions are determined.

Changes

Now the splitter positions are set in OnShown instead of OnLoad. This ensures that the window size is the same as when the position was saved, and the layout will not be rearranged afterwards. The position is now always the same after closing and re-opening CKAN.

@HebaruSan HebaruSan added Bug Something is not working as intended GUI Issues affecting the interactive GUI Pull request labels Dec 3, 2018
@politas politas merged commit abe887e into KSP-CKAN:master Dec 12, 2018
@HebaruSan HebaruSan deleted the fix/splitter-migration branch December 12, 2018 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended GUI Issues affecting the interactive GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants