{"id":122,"date":"2006-01-29T18:54:42","date_gmt":"2006-01-30T02:54:42","guid":{"rendered":"http:\/\/www.corbinstreehouse.com\/blog\/?p=122"},"modified":"2018-10-31T10:15:16","modified_gmt":"2018-10-31T17:15:16","slug":"cocoa-drop-down-menu-buttons","status":"publish","type":"post","link":"https:\/\/www.corbinstreehouse.com\/blog\/2006\/01\/cocoa-drop-down-menu-buttons\/","title":{"rendered":"Cocoa: drop down menu buttons"},"content":{"rendered":"<p id=\"top\" \/>In Cocoa, it is pretty easy to use an NSButton that creates a drop down menu. One of the key-tricks to making it appear to be an NSPopUpButton is to set the [NSCell sendActionOn:]. Generally, menus are displayed on mouse down, not up. Normally, the action for a button is sent on mouse up. To get around this, you can simply access the cell of your button and tell it to send the action on mouse down:<\/p>\n<p>  [[mybutton cell] sendActionOn:NSLeftMouseDownMask];<\/p>\n<p>Cool!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Cocoa, it is pretty easy to use an NSButton that creates a drop down menu. One of the key-tricks to making it appear to be an NSPopUpButton is to set the [NSCell sendActionOn:]. Generally,&#8230; <a class=\"read-more\" href=\"https:\/\/www.corbinstreehouse.com\/blog\/2006\/01\/cocoa-drop-down-menu-buttons\/\">[read more]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4,6,1],"tags":[63,130,72],"class_list":["post-122","post","type-post","status-publish","format-standard","hentry","category-apple","category-cocoa","category-general","tag-cocoa","tag-objc","tag-programming"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/posts\/122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/comments?post=122"}],"version-history":[{"count":1,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/posts\/122\/revisions"}],"predecessor-version":[{"id":5326,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/posts\/122\/revisions\/5326"}],"wp:attachment":[{"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/media?parent=122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/categories?post=122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/tags?post=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}