Array Controller Selection Reset

Writing a small app based in part on Chapter 5 of Shane Stanley’s Excellent Book. Works perfectly but .

1/ Load a list of books to an Array Controller
2/ Setup a double click so it will display the details behind the book in the same table, replacing it contents

Works well.

Added a search field, which enables me to look for a specific book (as oppose to browsing the list) . double click on the found book in my list; it goes away and get the details; but fails to delete the existing list of books , it just adds the details of the book selected to the list… in a nutshell with the predicate set the removeObjects removes the selected object only, not the list of books. (If I simply browse the list and double click, it works perfectly).

tell theArrayController
removeObjects_(arrangedObjects())
addObjects_(tempList)
end tell

Maybe that is normal… but how can I clear the selection in my AppleScriptObjC code so I can replace the list of books with the details of the selected one if I am using the predicate feature.

Hi,

you can write for example


arrayController's setSelectionIndexes_(current application's NSIndexSet's indexSet())

this sets the selected indexes to an empty index set

Fantasic!

Works perfectly. THANKS!! :smiley: