MenuHasParentException
From Real Software Documentation
Class (inherits from RuntimeException)
| This class is only available on the OS X Cocoa platform. For cross-platform development, use #If...#Endif with the Target... specifiers to make sure you will not attempt to use this class on an incompatible platform. |
Occurs when code tries to use the same MenuItem in different places. This is a limitation of the Cocoa framework.
| NOTE: Starting with the upcoming Real Studio 2011r4, the same behavior will apply to all platforms. If you currently use the same MenuItem in more than one location, you should use the new MenuItem.Clone method create independent duplicates of the original MenuItem and switch to the new design. See this article on the Real Software blog for more information. |
Examples
Whenever you need to use the same MenuItem in different places, use the Clone method to create a new copy of the MenuItem and its children, if any.
dim mi as new MenuItem( "My menu item" )
dim myClone as MenuItem
myClone = mi.Clone //Creates an independent copy of "mi"
dim myClone as MenuItem
myClone = mi.Clone //Creates an independent copy of "mi"
