Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSPopupButton won't call validateMenuItem

NSPopupButton won't call validateMenuItem
Thread Tools
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status: Offline
Reply With Quote
Jun 15, 2005, 09:38 PM
 
I have an NSPopupButton on a modal window.

I have set the target to be self in my controller class, for every menu item I add to the NSPopupButton.

I have implemented worksWithModal.
I have implemented -(BOOL)validateMenuItemNSMenuItem *)menuItem

but validateMenuItem is never called when clicking in the popup menu. Am I missing something?
     
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Jun 15, 2005, 11:05 PM
 
Do you mean worksWhenModal?

Also, I'm not sure that validateMenuItem is called for popup button menus (it might be, I'm just not sure). You could try listening for NSPopUpButtonWillPopUpNotifications sent from the button, though.
[Wevah setPostCount:[Wevah postCount] + 1];
     
hayesk  (op)
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status: Offline
Reply With Quote
Jun 16, 2005, 10:46 AM
 
I figured it out.

You need to set both a target and an action for the popup in order for it to call your validateMenuItem method.

I was setting the target, but not the action, since it doesn't need one. I made a dummy method for the action and it all works now.
     
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Jun 16, 2005, 10:15 PM
 
D'oh. I knew that, too. Poop.

Well, I'm really just glad you got it sorted.
[Wevah setPostCount:[Wevah postCount] + 1];
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:16 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2