FROM : Steven Kramer
DATE : Thu Dec 16 19:16:44 2004
NSMenuItem implements NSCopying, so you can copy the items from the
other menu on menuNeedsUpdate, or something like that.
Caveat: the represented object of an item should also support
NSCopying, or the app will crash. This may actually be a bug I need to
file.
Regards
Steven
Op 16-dec-04 om 16:00 heeft Clark Cox het volgende geschreven:
> On Thu, 16 Dec 2004 11:28:32 +0200, Christiaan Hofman
> <christiaan.<email_removed>> wrote:
>> Hi,
>>
>> I am trying to share a menu of a pulldown button with the main menu
>> (in
>> a subclass of NSPopUpButton that draws itself without regard to the
>> first item). The problem of course is the conflict with the base of
>> the
>> item indexing (0-based in most menus, 1-based in pulldown). The
>> NSPopUpButton seems to mess with the menu to (partly) take care of it,
>> but does so in a way that does not work for me. Can anyone tell me
>> what
>> NSPopUpButton precisely does with the menu, as I can not make sense
>> out
>> of what I see. This is what I noticed:
>>
>> 1. After the menu is set in the pulldown menu (using setMenu), the 1st
>> item is removed/hidden while the last item is duplicated.
>> 2. After the pulldown menu has at least once been popped up, this last
>> duplicated item is not there anymore, but the 1st item is still
>> removed/hidden (as I guess it should).
>> 3. When the pulldown menu deallocates, the1st item shows up again.
>> Even
>> if there is another pulldown button sharing the same menu (this is a
>> doc based app).
>> 4. If the 1st item happens to have a NULL action, the app crashes when
>> a pulldown button deallocates.
>>
>> Can anyone tell me what precisely is happening in these steps? And how
>> would I properly share the menu?
>
> Your troubles seem to indicate that menus cannot be shared in such a
> way. My solution would be to not share such a menu, but to give each
> control (and the menu bar) its own instance.
>
>
>
> --
> Clark S. Cox III
> <email_removed>
> http://www.livejournal.com/users/clarkcox3/
> http://homepage.mac.com/clarkcox3/
> _______________________________________________
> MacOSX-dev mailing list
> <email_removed>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev
>
DATE : Thu Dec 16 19:16:44 2004
NSMenuItem implements NSCopying, so you can copy the items from the
other menu on menuNeedsUpdate, or something like that.
Caveat: the represented object of an item should also support
NSCopying, or the app will crash. This may actually be a bug I need to
file.
Regards
Steven
Op 16-dec-04 om 16:00 heeft Clark Cox het volgende geschreven:
> On Thu, 16 Dec 2004 11:28:32 +0200, Christiaan Hofman
> <christiaan.<email_removed>> wrote:
>> Hi,
>>
>> I am trying to share a menu of a pulldown button with the main menu
>> (in
>> a subclass of NSPopUpButton that draws itself without regard to the
>> first item). The problem of course is the conflict with the base of
>> the
>> item indexing (0-based in most menus, 1-based in pulldown). The
>> NSPopUpButton seems to mess with the menu to (partly) take care of it,
>> but does so in a way that does not work for me. Can anyone tell me
>> what
>> NSPopUpButton precisely does with the menu, as I can not make sense
>> out
>> of what I see. This is what I noticed:
>>
>> 1. After the menu is set in the pulldown menu (using setMenu), the 1st
>> item is removed/hidden while the last item is duplicated.
>> 2. After the pulldown menu has at least once been popped up, this last
>> duplicated item is not there anymore, but the 1st item is still
>> removed/hidden (as I guess it should).
>> 3. When the pulldown menu deallocates, the1st item shows up again.
>> Even
>> if there is another pulldown button sharing the same menu (this is a
>> doc based app).
>> 4. If the 1st item happens to have a NULL action, the app crashes when
>> a pulldown button deallocates.
>>
>> Can anyone tell me what precisely is happening in these steps? And how
>> would I properly share the menu?
>
> Your troubles seem to indicate that menus cannot be shared in such a
> way. My solution would be to not share such a menu, but to give each
> control (and the menu bar) its own instance.
>
>
>
> --
> Clark S. Cox III
> <email_removed>
> http://www.livejournal.com/users/clarkcox3/
> http://homepage.mac.com/clarkcox3/
> _______________________________________________
> MacOSX-dev mailing list
> <email_removed>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev
>
| Related mails | Author | Date |
|---|---|---|
| Christiaan Hofman | Dec 16, 10:28 | |
| Clark Cox | Dec 16, 16:00 | |
| Steven Kramer | Dec 16, 19:16 |






Cocoa mail archive

