Select Row Method selectRow:byExtendingSelection:

Hi

I use the code

set selected row of table view "a" of scroll view "a" of window "b" to 2

and I get the following comment in the Log after compiling:
*** WARNING: Method selectRow:byExtendingSelection: in class NSTableView is deprecated. It will be removed in a future release and should no longer be used.

I looked up many posts but didn’t find any help. Apple propose to use the method (void)selectRowIndexes:(NSIndexSet *)indexes byExtendingSelection:(BOOL)extend;, see http://developer.apple.com/mac/library/releasenotes/cocoa/AppKitOlderNotes.html

But in Applescript I can’t use select row index or anything similar. :frowning:

Does anyone have the same issue?

Regards
Martin

the AppleScript equivalent of selectRowIndexes:byExtendingSelection: might be


set selected rows of table view "a" of scroll view "a" of window "b" to {2}

Hi Stefan

I tried that, but no luck, same error message…

Regards
Martin

Here’s the solution:


set tIndexLocation to 1
set tIndexLength to 2
set myRange to {tIndexLocation, tIndexLength}
set myIndexSet to call method "indexSetWithIndexesInRange:" of class "NSIndexSet" with parameter myRange
				call method "selectRowIndexes:byExtendingSelection:" of (table view "profiles mainwindow" of scroll view "profiles mainwindow" of split view 1 of window "iBackup") with parameters {myIndexSet, false}

Works from 10.3.9 to newest versions :slight_smile: