I wanted to select a row in a table typing its index in a text field, so I binded the text field to a property and the selection indexes of the array controller to another one.
Ok, in the end I figured it out how to do that, and now the app works perfectly.
The reason why I’m opening this thread is that I don’t understand very well what’s really happening in the code I wrote (I do know: it seems unbelievable…) and I’d like to know more about it.
So my code is this:
on tableSelect(prm)
set tmp to my selIdx
tmp's removeAllIndexes()
tmp's addIndex_(prm)
set my fileList to my fileList
set my selIdx to tmp
end tableSelect
where prm is a given number, selIdx is the selection indexes property and fileList is the array controller property. It looks like that’s the only way selecting a table row from within the code. I tried lots of different combinations but none of them worked. So in particular I’m wondering why It’s necessary to “reload” the array controller property (that is setting it again with itself) before setting selIdx to its new value…
Just curious, nothing more.
Thank you