Macro edit window default position

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
User avatar
Bone White
Great Wyrm
Posts: 1124
Joined: Tue Aug 23, 2011 11:41 am
Location: Cornwall, UK

Macro edit window default position

Post by Bone White »

This has been irritating me for the last few days, but I finally figured out how to fix it. My macro edit window was drawing so low down that ok and cancel were drawn behind my taskbar, so I either had to drag the window out every time or use ctrl+enter to submit the changes. I tried re-installing MapTool and all sorts of other things, but what finally fixed it was closing the edit macro window with the X in the top right. This makes MapTool remember the size of the window and the location.

Thought this might be useful for people to search for on the forums to find the answer, or for anyone else having the same problem.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Macro edit window default position

Post by wolph42 »

Join the club. I figured this out and posted it 1.5 years ago. But it's good to bump this from time to time. Note that it also works if you close the window by double clicking thumper left corner.

User avatar
Bone White
Great Wyrm
Posts: 1124
Joined: Tue Aug 23, 2011 11:41 am
Location: Cornwall, UK

Re: Macro edit window default position

Post by Bone White »

I did try searching both in forums and using google to site search, oh well.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Macro edit window default position

Post by wolph42 »

Bone White wrote:I did try searching both in forums and using google to site search, oh well.
I know, what on earth will your search string be for this one??!

User avatar
Bone White
Great Wyrm
Posts: 1124
Joined: Tue Aug 23, 2011 11:41 am
Location: Cornwall, UK

Re: Macro edit window default position

Post by Bone White »

Hopefully two or more of the five words in the title <_<

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Macro edit window default position

Post by Azhrei »

Bone White wrote:[...] what finally fixed it was closing the edit macro window with the X in the top right. This makes MapTool remember the size of the window and the location.
Sounds like a bug. :?

What is likely happening is that the Java object that represents the dialog (called a JDialog) is being completely destroyed when you submit it and the location is also freed up. But when you close it from the X the dialog is disposed instead and the location is retained. Seems strange though; most Swing components don't work like that. (Although dialogs are different from regular Swing components in quite a few ways.) I'll take a look at the code.

User avatar
Bone White
Great Wyrm
Posts: 1124
Joined: Tue Aug 23, 2011 11:41 am
Location: Cornwall, UK

Re: Macro edit window default position

Post by Bone White »

Note that the same applies to the cancel button Az. We're not asking for a fix because the work around is so simple, but we appreciate your eagerness.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Macro edit window default position

Post by Azhrei »

Something strange is going on. The existing code calls both setVisible(false) and dispose() on the dialog when the OK or Cancel buttons are used. By default, the Close button in the titlebar only causes setVisible(false).

So, logically, I should be able to remove the dispose() and get the same behavior, but that doesn't work. The Close button remembers the location of the dialog and the OK and Cancel do not. There's still something else going on. I'll continue to look into this over the next day or two.

username
Dragon
Posts: 277
Joined: Sun Sep 04, 2011 7:01 am

Re: Macro edit window default position

Post by username »

The x goes through a different path on the OS window manager than the ok and cancel. That may make the difference.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Macro edit window default position

Post by Azhrei »

Ah, very likely. To really check this I'll need to run it on other OSes and see (it will be awhile before I get to that though).

Great catch. :)

User avatar
Xaelvaen
Dragon
Posts: 498
Joined: Wed Aug 31, 2011 9:49 pm
Location: Somewhere between Heaven and Hell

Re: Macro edit window default position

Post by Xaelvaen »

This same issue/fix works on other frames as well. For the longest time, my custom character sheet frame just would not remember its location. It remembers the size, but never the relative position. However, thanks to reading this post, x-canceling the frame and then saving the campaign worked well. It now remembers its location.
"An arrogant person considers himself perfect. This is the chief harm of arrogance. It interferes with a person's main task in life - becoming a better person." - Leo Tolstoy

Post Reply

Return to “MapTool”