Stupid interface question

Hi:

I set up a user interface using a Combo Box with all the items in alphabetical order.

I need to add an item to the list and every time I try to add an item, it drops to the bottom and I can’t seem to figure out a way to drag it to where it belongs.

Could someone tell me the trick to do this?

Thanks.

Jon

How are you adding the original list of items? Are you using bindings or adding them with one of the addItems methods?

I’m just loading them in the Combo Box Attributes Inspector under “Items”. I set them up originally by just hitting the plus sign and typing over the resultant “Item”. In the old Applescript Studio interface I could just drag an item to a new place in the list, but that doesn’t seem to be working in the new xCode.

I don’t know any way to fix that in IB, however in code, you can just sort the combo box’s objectValues:

combo's objectValues()'s sortUsingSelector_("caseInsensitiveCompare:")

Ric

That’s kind of cool. I’ll give that a shot. Thanks.

Ric:

I guess I’m not grasping how to use your code snippet properly. I want to sort the selections of two combo boxes so they are in alphabetical order when the user hits the pull-down and makes his/her selection.

script AppDelegate

    property parent : class "NSObject"
        
    --IBOutlets
	--Combo Boxes
	
	property existingClient : missing value
	property newTactical : missing value
	
	
	   
on applicationWillFinishLaunching_(aNotification)
   existingClient's objectValues()'s sortUsingSelector_("caseInsensitiveCompare:")
	newTactical's objectValues()'s sortUsingSelector_("caseInsensitiveCompare:")
end applicationWillFinishLaunching_

	
	
on setWindowValueFields_(sender)
	log "Button clicked"
	set existingClientValue to existingClient's stringValue() as text
 	set newTacticalValue to newTactical's stringValue() as text
end setWindowValueFields_

So I’m assuming that I need to do that using the applicationWillFinishLaunching_ since I want it to happen before they make their selection. Just getting a “no pool in place” error when I try to build this.

Could you give me a little more help? Thanks.

–jon

ric:

Please ignore my last post. I had left another applicatonWillFinishLaunching handler at the bottom of my code. It’s all working fine now.

Thanks again for your help.

–jon