wxMenuItem with NULL parent Menu in OSX Cocoa

10 views
Skip to first unread message

Dion Whittaker

unread,
Jul 6, 2011, 6:14:33 AM7/6/11
to wx-u...@googlegroups.com
Morning,

I have upgraded from 2.9.1 OSX Carbon to 2.9.2 OSX Cocoa.

One of the issues I found was that it it no longer seems to be possible
to create a wxMenuItem with a NULL parent menu.
The menu sample can be used to duplicate the issue.

#if USE_LOG_WINDOW
wxMenuItem *item = new wxMenuItem(fileMenu, Menu_File_ClearLog,
wxT("Clear &log\tCtrl-L"));
#if wxUSE_OWNER_DRAWN || defined(__WXGTK__)
item->SetBitmap(copy_xpm);
#endif
fileMenu->Append(item);
fileMenu->AppendSeparator();
#endif // USE_LOG_WINDOW

change this to

#if USE_LOG_WINDOW
wxMenuItem *item = new wxMenuItem(NULL, Menu_File_ClearLog,
wxT("Clear &log\tCtrl-L"));
...

and an exception is thrown.

The same change seems to work fine under 2.9.1 Carbon.

The documentation for wxMenuItem specifies that the parentMenu argument
may be NULL.

Regards
Dion

Stefan Csomor

unread,
Jul 6, 2011, 7:06:07 AM7/6/11
to wx-u...@googlegroups.com
Hi

>One of the issues I found was that it it no longer seems to be possible
>to create a wxMenuItem with a NULL parent menu.
>The menu sample can be used to duplicate the issue.

thanks for the sample, fix committed to trunk

Best,

Stefan

Reply all
Reply to author
Forward
0 new messages