# MWorks changes to make windows remember their positions

**URL:** <https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708>\
**Category:** Support\
**Created:** [August 6, 2010, 6:42pm UTC](https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708 "2010-08-06T18:42:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [August 6, 2010, 6:42pm UTC](https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708/1 "2010-08-06T18:42:38Z")

</div>

Hi Chris,

We made some changes to the code so that the various plugins remember where they were, and it also remembers which plugins you want open.

The relevant code tree is in

[http://github.com/jonhendry/MWorks/tree/8e66ba3cfc6585943511cc603de7985fb4762d61](http://github.com/jonhendry/MWorks/tree/8e66ba3cfc6585943511cc603de7985fb4762d61)

Can you merge this in?

Thanks,

Jon

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [August 9, 2010, 4:27pm UTC](https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708/2 "2010-08-09T16:27:13Z")

</div>

Thanks, Jon. I’ll take a look at your patch.

Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [September 14, 2010, 4:22pm UTC](https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708/3 "2010-09-14T16:22:16Z")

</div>

[From Jon]

Hi Chris,

Here are some more patches for window-position-saving, for mw\_cocoa, mw\_client\_plugins (Behavior Window and Variables Window), and mw\_client.

The code also makes the Variables Window expand the outline view automatically.

I think I may have left these out of the last patch I sent.

Jon

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [September 14, 2010, 4:22pm UTC](https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708/4 "2010-09-14T16:22:16Z")

</div>

Attachments:

- [mw\_client\_plugins.patch](https://mworks.discourse.group/uploads/short-url/92K2ZW7FldJTc9AyWJFoP8wgq8K.patch) (1.96 KB)
- [mw\_client.patch](https://mworks.discourse.group/uploads/short-url/eXimwq0QMorDoNDiEAgN0EiR3Uv.patch) (3.77 KB)
- [mw\_cocoa.patch](https://mworks.discourse.group/uploads/short-url/8gFRYcCwHNQIDrqf4nLtGQMeNh0.patch) (1.15 KB)

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [September 14, 2010, 4:30pm UTC](https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708/5 "2010-09-14T16:30:55Z")

</div>

Thanks, Jon. This seems like a good change. Unfortunately, there’s been a bunch of higher-priority stuff on my to-do list, and I haven’t gotten to this yet.

One comment: Your initial patch (and perhaps the new ones, too?) is against the “0.4.3” codebase and can’t be applied to the latest code. Any chance you can update your patches to work with the latest code on GitHub? If not, I’ll have to re-implement your changes.

Thanks,  
Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [September 14, 2010, 4:41pm UTC](https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708/6 "2010-09-14T16:41:55Z")

</div>

Hi Chris,

Good news: My latest patches are from a clone of the 0.4.4 master branch.

- Jon

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [September 14, 2010, 5:03pm UTC](https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708/7 "2010-09-14T17:03:42Z")

</div>

> Good news: My latest patches are from a clone of the 0.4.4 master branch.

Awesome, thanks!

Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [September 30, 2010, 10:17pm UTC](https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708/8 "2010-09-30T22:17:40Z")

</div>

Hi Jon,

Sorry for not getting back to you about this sooner.

I just took a look at your patches. I already implemented saving the position and size of plugin windows in [this commit](http://github.com/mworks-project/mw_client/commit/25601aea9ae54370b18a82a1361f5e87a0e1e80e), so your mw\_cocoa patch and some of your mw\_client\_plugins patch aren’t necessary.

The net effect of your changes to the variables window seems to be that all variable groups are always expanded; if you try to close one, it immediately reopens. That doesn’t seem like the right behavior to me. Was that your intent?

As for the mw\_client patch, I agree that the open/closed state of client windows should be preserved, both within and between sessions. However, I think that you need to serialize the list of “preferred” windows using something more robust than simple numeric indices. I’ll think about a different approach.

Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [September 30, 2010, 10:31pm UTC](https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708/9 "2010-09-30T22:31:11Z")

</div>

> However, I think that you need to serialize the list of “preferred” windows using something more robust than simple numeric indices.

Actually, it looks like you aren’t persisting that list at all, although you do try to read it from the preferences at startup. Did you decide against saving window state between MWClient sessions, or is it just not fully implemented?

Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [October 18, 2010, 6:54pm UTC](https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708/10 "2010-10-18T18:54:14Z")

</div>

Chris,

mw\_client’s AppController should have this method to persist the default:

// Write the open plugin list to the defaults database.

- (void)applicationWillTerminate:(NSNotification \*)aNotification  
{

I see your point about the indices. Names would probably be better, in case the ordering changes.

WRT the Variables window, the intent was simply to have it default to being open. I suppose Mark’s usage pattern is to keep the outline expanded, and having to expand the outline every time was tiresome.

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 19, 2022, 11:53pm UTC](https://mworks.discourse.group/t/mworks-changes-to-make-windows-remember-their-positions/708/11 "2022-07-19T23:53:28Z")

</div>


