Setting the First Responder to a Table Cell

Hello everyone,

I hope this finds you well. Evening greetings from Seoul, Korea.

I am posting to ask about how to set the first responder to a table cell. I have no trouble setting the first responder to regular text fields, for which there are countless examples in various postings around the web, in Apple samples, and in documentation.

However, after creating a new row in my table, I want to set the first responder in one of the cells of the new row so that the user may begin inputing information in the rows not automatically filled by my script.

set theTableView to table view "entryList" of scroll view "mainTable" of view "listView" of split view "vertSplit" of view "rightHalf" of split view "horizSplit" of main window
set entryDataSource to data source of theTableView
(* Make a new row in the entry list *)
set newEntryContents to make new data row at end of data rows of entryDataSource
(* Give the new entry an id number *)
set the contents of data cell "fieldNumber" of newEntryContents to (count data rows of entryDataSource)
(* Set the IS stage to 0 *)
set the contents of data cell "fieldIS" of newEntryContents to 0
(* Load a transparent image for the flag field since it isn't flagged by default *)
set contents of data cell "fieldFlag" of newEntryContents to load image "trans"
set first responder of main window to (* HERE IS WHERE I'M CONFUSED *)

I believe that the reason I am having trouble setting the first responder is that most of these references are to components of a data source, rather than directly to things like table cells that (presumably) can be a “first responder”

How does one set the first responder to a cell within a column/row for a table?


K. M. Lawson

Is there really no way at all to set the first responder to an individual table cell?

In other words, no way to help the user by allowing them to edit a table cell of the program’s choosing?

Hello everyone,

I posted the same question on the AppleScript Studio mailing list and got a very helpful reply to my question from Philip Buckley which you can see below if you ever have a similar need. I’ll report back on my own attempts to do this:

You can do it with this call method:


The method takes 4 parameters:

  1. the column index – NB this is zero-based, so first column is 0, second column is 1 etc
  2. the row index - NB this is zero-based, so first row is 0, second row is 1 etc
  3. an NSEvent – should be nil I think, but for this purpose it seems it will accept pretty much anything, so in the example below, which I have tested, I have pased 0
  4. a boolean – 1 for true

You can find the documentation for the method in the XCode documentation under the NSTableView class or here on the web: < >

Here is an example that … makes a table view the first responder of a window, selects the fifth row in the table view, selects the content of the editable cell in the fourth column of that row:

set theWindow to window 1
set theTable to table view 1 of scroll view 1 of theWindow

set first responder of theWindow to theTable
set selected row of theTable to 5
call method “editColumn:row:withEvent:select:” of object theTable with parameters {3, 4, 0, 1}


I created a sample XCode project implementing the solution I mentioned above provided by Philip Buckley. Description of the project here:

Direct download for the XCode project is here:

I hope someone may find it useful some day.


K. M. Lawson