Search code examples
objective-cnscomboboxnsalert

NSComboBox into NSAlert


First of all I'm kind of new in Objc. (so try to explain me like. . . for dummies XD) Well my question is: Is there any way to show a NSComboBox inside a NSAlert? that's it! I've check the documentations, an it says that it is possible to show a NSTextView, but I'm wandering if anyone has done this before (with the NSComboBox), a code example would be really useful!

Thank's in advance!!!


Solution

  • Eureka!!!

    is really simple, you just have to remember that NSButton, NSTextField, NSComboBox. . . (etc) inherits from NSView so, you just need to send the object you need into your NSAlert like this:

    [specialtyAlert setAccessoryView:specialtyOptions];
    

    where specialtyAlert is an instance of NSAlert, and specialtyOptions is an instance of NSComboBox (but it could be an instance of NSButton or any other GUI object).