Selecting item in Combo Box

Hey everyone!

Can’t seem to find an answer to this, any help would be greatly appreicated. I am simply trying to select the item of a combo that I just added.


tell combo box "photographer" of window 1
				make new combo box item at end of combo box items with data newPhotographer
				set current item to (first item whose title is newPhotographer)
			end tell

It adds to the end of the combo box with out problem but I can’t seem set current item to it. Would the best approach be to count the items then

set current item to countofrows

if so I am not sure how to count the items.

Thanks

Hi rnosek

this deals with setting the current item, seems that counting is the way

on awake from nib theObject
	set newPhotographer to "Budgie" --as text
	tell combo box "photographer" of window 1
		make new combo box item at end of combo box items with data newPhotographer
		set current item to 1
	end tell
end awake from nib

Yes, I can set the current item to a any number, but I need it set to the last item (what I just added). I do not know what number that is.

How can I count the rows of the combo box?

Thanks,

I got it working after trying a few more things. Hope this saves someone a little time.


                     tell combo box "photographer" of window 1
				make new combo box item at end of combo box items with data newPhotographer
				set currnetlist to every combo box item of combo box "photographer" of window 1
				set num_photographer to count currnetlist
				set current item to num_photographer
			end tell

Does anybody know how to bind combo box to the text filed?