detecting NSTableView selected line number with bindings
detecting NSTableView selected line number with bindings
- Subject: detecting NSTableView selected line number with bindings
- From: Denis Stanton <email@hidden>
- Date: Wed, 18 May 2005 11:10:21 +1200
I'm new to bindings and I can't figure out how to detect the index of the selected line.
I have a document-based application with an NSTableView bound to an NSArrayController. Data entered in the tableView is added and edited correctly into the array so the basic NSArrayController bindings are in place
I want to know the index number of the selected line when the user clicks in a line or tabs to it.
Prior to Bindings I could add something to tableView:ObjectValueForTableColumn:row:, but I no longer have that method.
My NSArrayController is bound to "File's Owner (myDocument)" with Model Key Path set to an array. I don't know what else to bind to what in order to be able to see the selectionIndexes.
It's also possible that there is a better way of achieving the objective. What I'm trying to do is save the user from having to click "add new line" all the time. I would like the application to detect when the selection is on the bottom line of the NSTableView and automatically add one new line below it.
The user would be able to <tab> or <return> through the table and new lines would be added if required. This app will replace an office task that is currently accomplished with a spreadsheet. With Excel you don't have to request a new line at the bottom of a spreadsheet so I don't want my app to require this. I suppose I could initialise the table with hundreds of rows, but that seems a poor solution. My save method will detect trailing blank lines and omit them.
Denis
<x-tad-smaller>Denis Stanton
Orcon Internet Limited
(09) 480 9299
</x-tad-smaller><x-tad-smaller>http://www.orcon.net.nz
</x-tad-smaller><x-tad-smaller>
</x-tad-smaller> _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden