Dick Hollenbeck wrote:
I wasn't suggesting unconditional support for this. As I expected,
there are cases where it doesn't work. I was trying to alert other
developers to a possible solution to layout differences between
platforms. Maybe the policy should be more generic to have developers
make sure that initial dialog layouts are sane.
Yes, we should make a policy saying that people may not do insane
things. I'm all for that. :)
One would think a policy for that would not be necessary but history
would suggest otherwise :)
I think this should be
part of UIPolicies.txt. Remember the previous EESchema options dialog
where the word "Parameters" was truncated due to a sizer issue? I think
most users would expect the initial dialog size not to obscure any
control text and at least be usable without having to first resize it.
OK.
A far more useful benefit to the user is to remember the size and
position of these dialogs on close, so it can come up with size he likes
according to how he set it previously. This is what I have been coding
recently and you can find it in DRC and Layer setup. The nice thing
here is that for a dual monitor setup, the dialog can be told to come up
on the second monitor, and with the size you last preferred.
Agreed. After the initial size, let the user configure the dialog the
way they want it. I see a base dialog class in your future;)
Well I have found a rather simple trick to override the Show(bool)
method of the dialog and to save or use the static last size and
position. But the problem with hiding this in a base class is that the
static position and size would then become common to all derived
dialogs, meaning all your dialogs would be the same size and be in the
same position. Funny hey? So I won't rush to that solution.
This would make for some surprised users and interesting bug reports.
But I still have one curiosity I'd like answered about the strategy,
before I call it perfected. If you take a look at
bool DIALOG_LAYERS_SETUP::Show( bool show ) in dialog_layers_setup2.cpp
and at
bool DIALOG_DRC_CONTROL::Show( bool show ) in dialog_drc.cpp
And compare the if( show ) block in both. In one I am first calling the
old Show() before SetSize() whereas in the other I am calling SetSize()
before the old Show(). Either works fine. Don't know which to stick
with. You have any ideas on this?
A quick look at the wxWidgets source shows that it could be a couple of
things. wxWidgets uses deferred resizing ( at least on win32, I'm not
sure about GTK or OSX as I don't have the full source right in front of
me ) to prevent flicker so in your case it may only be getting sized
once. If the size isn't any different than the current size, the
SetSize() call is ignored. It could also just be that the redraw so
fast that you don't notice it. You can be assured that on at least one
platform it will behave differently and that you will have to use trial
and error to figure out which of the two methods is best.
Wayne