i am new to xcode and applescriptobjc. I am creating a project where I need to make a combo box and it should have 25 items . I have searched this forum and got lot of answers. However, i am confused. so can anyone help me on how to add items to combo box.
You define a property, called cb in my example, connect it in IB to your combo box, and then just use addItemsWithObjectValues:
property cb : missing value -- IBOutlet connected to the combo box
on applicationWillFinishLaunching_(aNotification)
cb's addItemsWithObjectValues_({"First", "second", "Third", "fourth"})
end applicationWillFinishLaunching_
property parent : class "NSObject"
property cb : missing value
on applicationWillFinishLaunching_(aNotification)
log cb
cb's additemWithObjectValues_({"First", "Second", "Third", "Fourth"})
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate_
end script
if you can send me sample script for combo box for reference then it will be great.
No, I don’t mean the terminal. Under the run menu in Xcode there’s a choice labeled console. Choose that, and then hit run to run your program, and see what the log says.
yes there are other ways, but they are more complicated. The code you have should work, I’ve tested it. So you must be doing something else wrong.
I don’t understand what you want. I showed you in my first post how to add items to a combo box. It’s very simple, just one line of code. You still did not tell me what the log said. I can’t help you if you won’t respond to my requests.
Open the console window under the Run menu in Xcode, select Console then run your program. Tell me what you see in the log.
Ric
2011-11-07 12:02:46.644 menuitem[1493:707] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found. Did find:
/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper
menuitem: OpenScripting.framework - scripting addition “/Library/ScriptingAdditions/Adobe Unit Types.osax” declares no loadable handlers.
Hmm… Is the script you posted above, the whole script? I don’t know why you would be getting errors about Adobe stuff if it is. Did you make the change (adding the missing s) that Stefan posted? That should fix your code. Are you still not getting any items in your combo box?
yes i have made the changes, but i am not getting any item in combo box. in inspector panel there is an option to add items to box. however, they are being added by same name that is “Item”. is there any option to change the name of these items. these items are visible.