lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Suitable parenting (was: A no-longer-reproducible anomaly)


From: Vadim Zeitlin
Subject: Re: [lmi] Suitable parenting (was: A no-longer-reproducible anomaly)
Date: Sat, 10 Mar 2018 20:16:46 +0100

On Sat, 10 Mar 2018 02:07:35 +0000 Greg Chicares <address@hidden> wrote:

GC> Since you're more familiar with wx history than I...do you know what
GC> ever happened to wxFindSuitableParent()?

 It was removed in b6e96faf3eb7b8bda2b1d7fc8aac4e212607da31 (as found by
"git log -GSuitable src/common/docview.cpp" -- if I didn't know it had been
previously in this file, I would have just omitted the file name and used
the full function name, which I abbreviated here out of sheer laziness)
because, as the commit message laconically says, it was unnecessary.

GC> I just happened to be looking at 'docmanager_ex.cpp', because it's
GC> the only place where lmi's class SingleChoicePopupMenu is still used
GC> (the kink in the census menu having at last been removed):
GC> 
GC> // GWC changes begin
GC> /*
GC>             theTemplate = (wxDocTemplate*)wxGetSingleChoiceData
GC>                           (
GC>                             _("Select a document template"),
GC>                             _("Templates"),
GC>                             strings,
GC>                             (void**)data,
GC>                             wxFindSuitableParent()
GC>                           );
GC> */
GC>             int selection = SingleChoicePopupMenu(strings).Choose();
GC> 
GC> ...and I was intrigued enough to search for it. Finding it here:
GC>   https://github.com/LuaDist/wxwidgets/blob/master/src/common/docview.cpp
GC> I was even more intrigued--it seems to do exactly the right thing in this
GC> circumstance--better than the GetTopWindow() that SingleChoicePopupMenu
GC> uses. I was about to ask whether it could be made public instead of static,
GC> as it seems like a perfect candidate for reuse--but I looked for it in my
GC> local copy of the wx sources:
GC>   $grep --directories=skip GetSuitableParent 
/opt/lmi/wx-scratch/wxWidgets-3.1.0-p1/**/*
GC> and found nothing...so was it removed for a reason? or replaced by
GC> something better?

 For the use that was made of it in docview code, it was replaced with
wxDialog::GetParentForModalDialog() which is much smarter than the old
function was and so is definitely preferred.

 Unfortunately, in this case we don't really have any dialog at hand, and
creating one to just get an appropriate parent to use for it doesn't seem
like a good idea. But OTOH none of the corner cases this wxDialog method
protects you against seem likely to arise in lmi, so I think continuing to
use TopWindow(), i.e. the main frame, as the parent is the right thing to
do.

 Regards,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]