Select Object in Array

Hi folks,

I have an array created with some options:

This is populating fine, & I can get what the user selected.

But, the data in the array will already have a value… which I have. (For example, “Digital”).

What I’m looking to do is to highlight the row which contains the already set data… Such as the below:

Pointers needed as drawing a blank on how

It’s impossible to say unless you tell us where and how you’re displaying this stuff. And array is just a collection.

Hi Shane.

The variable ‘myChoices’ is an AppleScript list.

-- make list into an array so we can call array methods on it
        set theArray to current application's NSArray's arrayWithArray:myChoices
        -- set our property to sorted list
        set my theData to theArray's sortedArrayUsingSelector:"localizedStandardCompare:"

theArray’s contents have a binding to the delegate for the model key theData.

You’re still not answering the question: where you’re displaying this stuff. Is it a table? Are you using an array controller?

Sorry, it’s an array controller.

Try telling the array controller to setSelectedObjects:{“Digital”}

Brilliant, thanks Shane this worked :slight_smile:

theArrayController's setSelectedObjects_({myChoices})