On Fri, 4 Nov 2022 15:15:04 -0700 Kenneth Porter wrote:
KP> This was pretty easy to add.
Yes, that's the whole point -- this class makes it completely trivial to
retain the geometry and other UI state between program runs. It's a bit sad
that many people are still not aware of its existence, I should advertise
it even more than I did...
KP> I invoke this before the Show() for my main
KP> window:
KP>
KP> wxPersistentRegisterAndRestore(frame, "MainFrame");
KP>
KP> One problem remains: If I closed the window while it was off-screen, it
KP> gets restored that way.
Hmm, this is not supposed to happen, see the code at
https://github.com/wxWidgets/wxWidgets/blob/fec8c06a53f5f2eb65e3328eadddd22334e7971f/include/wx/private/tlwgeom.h#L127-L139
KP> So is there a convenience function for repositioning a window so
KP> all four corners are visible?
No, maybe it should indeed be added to wxTLW itself and be called from the
function above instead of being done just there, as it could be more
generally useful.
KP> I see I also should add a "View | Default" menuitem to restore the frame
KP> to "factory settings". (I don't see an obvious method for discarding the
KP> persisted settings so that the next startup uses the defaults, but I
KP> don't see much use for that except when debugging the default layout.
KP> For now I can use regedit to kill the appropriate tree.)
Yes, some way to forget (all?) the stored settings might be useful to have
too, e.g. after a major version upgrade. PRs adding it would be welcome!
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/