Re: Menu.Append/AppendSubMenu question
"'raf' via wx-users" <[email protected]>
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Mar 05, 2025 at 05:25:00PM +0100, Vadim Zeitlin <[email protected]> wrote: > On Wed, 5 Mar 2025 15:22:12 +1100 'raf' via wx-users wrote: > > r> I've just started converting a > r> python-2.7/wxpython-2.8.12.1 app to > r> python-3.12/wxpython-4.2.2. > r> > r> The first API change that I've run into is > r> Menu.Append(). > > There has been no changes to wxMenu::Append() in C++, so I'm not sure what > the real problem is. How do you call it exactly and what is the problem > you're seeing? > > r> It looks like it used to have > r> parameters: id, text, help (at least they were the ones > r> I used - there are others). And the names have changed > r> to: id, item, helpString. > > Other than the change of parameter name, this is still the same function > doing exactly the same thing as before. > > r> That's fine. but when I look at: > r> > r> https://docs.wxpython.org/wx.Menu.html#wx.Menu.Append > r> > r> It says: > r> > r> Deprecated This function is deprecated, use AppendSubMenu instead. > > Only the overload (in C++ sense) taking wxMenu submenu is deprecated. Thanks. > r> But more importantly, AppendSubMenu doesn't take an id > r> parameter. > > Because submenus don't have IDs. Ah, they used to. Thanks. > r> How do I pass it the Id? I also at some point saw > r> deprecation warnings for NewId(). > > This function is not formally deprecated at C++ level, but it's indeed not > recommended to use it because it allocates ID from 2 disjoint ranges which > can be unexpected. wxIdManager::ReserveId() can be used instead. The documentation says that NewIdRef() is a replacement. Is that corredt? > Regards, > VZ > > -- > TT-Solutions: wxWidgets consultancy and technical support > https://www.tt-solutions.com/ Many thanks. cheers, raf -- Please read https://www.wxwidgets.org/support/mlhowto.htm before posting. --- You received this message because you are subscribed to the Google Groups "wx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/wx-users/Z8kKnviaQEhs3ewV%40raf.org.