Re: Selecting Root of sub menu (NSMenu)
Re: Selecting Root of sub menu (NSMenu)
- Subject: Re: Selecting Root of sub menu (NSMenu)
- From: Rob Petrovec <email@hidden>
- Date: Mon, 21 Oct 2002 01:53:40 -0700
Unfortunately I am writing a plugin that does not have a runloop to play
with. So Carbon events won't work properly (if at all). But my plugin
definite gets loaded after the parent app has finished loading.
All I have are callback/access functions that the parent app calls, one of
which is to get the NSMenu associated with my plugin (which is where/when I
build my menu). After I have built my menu and passed it back to the parent
app, I have no control over it.
Any ideas? Thanks...
--Rob
On 10/20/02 1:42 AM, "Dustin Voss" <email@hidden> wrote:
>
On Saturday, October 19, 2002, at 03:06 AM, Rob Petrovec wrote:
>
>
> On 10/18/02 8:52 PM, "Dustin Voss" <email@hidden> wrote:
>
>
>
>> On Wednesday, October 16, 2002, at 06:59 PM, Rob Petrovec wrote:
>
>>
>
>>> I have an NSMenu that contains a couple submenu's. Each item has its
>
>>> own
>
>>> action to handle the selection of that item. The problem is that
>
>>> when
>
>>> the
>
>>> user selects the root of one of the submenu's (i.e. The item with the
>
>>> triangle in its name), the action selector doesn't get called.
>
>>> Nothing
>
>>> happens. Is there a way I can get this to work? Thanks for any
>
>>> help...
>
>>>
>
>>> --Rob
>
>>
>
>> You have to use an undocumented function _NSGetCarbonMenu to get the
>
>> Carbon MenuRef of the menu, and set the root item's
>
>> kMenuItemAttrSubmenuParentChoosable attribute. Without this, you can't
>
>> choose a sub-menu's parent at all.
>
>>
>
>> But, having set that attribute, I don't know if you can use Cocoa to
>
>> set an action. It may be that you'll have to use Carbon events to tell
>
>> if the item was selected. I just don't know. Maybe someone else can
>
>> take it from here?
>
>
>
> Thanks for the reply, but it seems that NSGetCarbonMenu only works with
>
> menu's created via Nib files. I am creating my menu from scratch in my
>
> code. When I call NSGetCarbonMenu it always returns NULL.
>
>
Are you calling _NSGetCarbonMenu after the
>
NSApplicationDidFinishLaunching notification?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.