• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: setAction:@selector is not working ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setAction:@selector is not working ?


  • Subject: Re: setAction:@selector is not working ?
  • From: "David M. Cotter" <email@hidden>
  • Date: Fri, 19 Feb 2010 12:45:27 -0800

yes i've set a breakpoint and watched.
in fact the values are the same before and after (indicating it was ALREADY set up correctly
note the code below is called JUST before the call to popup the menu

i only put that extra AE_OS_MAC stuff there to prove again that it is set correctly
in reality it is set ahead of time, when the menu is constructed
but either way, it fails until i switch out then back in.

	void	SetMenuCommands(dvaui::utility::OS_Menu *ioMenuP, short startIndexS)
	{
		dvaui::utility::OS_Menu::MenuID			menuID(GetMenuID(*ioMenuP));
		dvaui::utility::OS_Menu::MenuItemID		maxS(ioMenuP->Size());

		#ifdef AE_OS_MAC
			dvaui::ui::PlatformMenu		platMenu(dvaui::utility::GetPlatformMenu(*ioMenuP));
		#endif

		for (dvaui::utility::OS_Menu::MenuItemID itemIndexS = startIndexS; itemIndexS < maxS; ++itemIndexS) {
			dvaui::utility::OS_Menu::MenuItemID		itemID = ae_menu_utils::CreateMenuCommand(menuID, itemIndexS + 1);

			ioMenuP->SetItemID(itemIndexS, itemID);

			#ifdef AE_OS_MAC
				NSMenuItem*			nsMenuItem([platMenu itemAtIndex: itemIndexS]);
				DVAMacMenuItem*		dvaItem((DVAMacMenuItem *)nsMenuItem);

				[dvaItem setAction:@selector(dispatchMenuSelection:)];
				[dvaItem setTarget: dvaItem];
				[dvaItem setEnabled: YES];
			#endif

			if (startIndexS == 0) {
				dvaui::utility::OS_MenuSharedPtr		heirMenu(ioMenuP->GetItemSubMenu(itemIndexS));

				if (heirMenu.get()) {
					SetMenuCommands(heirMenu.get(), notifyByPosB);
				}
			}
		}
	}


On Feb 19, 2010, at 12:11 PM, Hank Heijink (Mailinglists) wrote:

> On Feb 19, 2010, at 2:43 PM, David M. Cotter wrote:
>
>> just before the line of code that pops up the menu, i iterate over all the items
>> so yes, i am absolutely sure it is getting called
>> and i am absolutely sure that myMenuItem is non null
>
> Posting you code is wildly more helpful than describing it. Also, are you absolutely sure because you've reasoned about your code, or are you absolutely sure because you've set a breakpoint and you've actually *seen* that all is well (i.e. the item exists, the target and action are what you expected)? If you haven't done the latter, you should not be absolutely sure.
>
> Hank
>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: setAction:@selector is not working ?
      • From: Graham Cox <email@hidden>
References: 
 >setAction:@selector is not working ? (From: "David M. Cotter" <email@hidden>)
 >Re: setAction:@selector is not working ? (From: Graham Cox <email@hidden>)
 >Re: setAction:@selector is not working ? (From: "David M. Cotter" <email@hidden>)
 >Re: setAction:@selector is not working ? (From: Jens Alfke <email@hidden>)
 >Re: setAction:@selector is not working ? (From: "David M. Cotter" <email@hidden>)
 >Re: setAction:@selector is not working ? (From: "Hank Heijink (Mailinglists)" <email@hidden>)

  • Prev by Date: Re: Appropriate -setWantsLayer: timing
  • Next by Date: Re: selectItemWithObjectValue
  • Previous by thread: Re: setAction:@selector is not working ?
  • Next by thread: Re: setAction:@selector is not working ?
  • Index(es):
    • Date
    • Thread