Binding a text field to a table column

I am working on a small application for archiving multiple files at a time. Every file has an job number associated with it. I want to enter the job numbers into a table view (via a text field).

I would like to bind the text field and the associated table column so that I can add new rows, update a selected row and delete a selected row without the code and interface elements normally involved with table maintenance.

I know I can do this with applescript code but I would love to simplify the process if possible. It would be nice to not have to have a “New” button, an “Update” button and a “Delete” button as well as the code for updating the table column, updating the text field, setting the enabled/disabled of the buttons. (I don’t want the buttons to begin with, let alone write the code enable/disable them.)

Is this something that can be done with bindings? I think I would need an array controller object, but I don’t know how to set everything up.

Brad Bumgarner, CTA

Brad,

I think I’m trying to do the same thing with the one column table I mentioned in the other thread.

For the most part it seems to work fairly well without any connections specified for actions. I’m just setting the contents of the table view to the list (or I suppose in table with more than one column, a list array {{row 1 column 1, row 1 column 2},{row 2 column 1},{row 2 column 2}}. Then when the user clicks a done button (or I suppose anything else appropriate), just get the list back from the table. User isn’t allowed to resize or drag rows/columns around etc, so none of that has to be handled. So you don’t actually need a text field. Unless I’m understanding you wrong.

I am starting out with an empty table. As numbers are entered, rows are added to the table. The user can not directly edit table data. I am hoping to simplify table maintenance with bindings.

Incidently, when I received the notice that you had replied, I was writing the code the get the data back out of the table.:lol:

Sorry I can’t be of more help, I think you’re well beyond me in working with tables. I’m still rather confused. :wink:

BTW the method you mentioned in the other thread of getting the data of every cell of every row didn’t seem to work for me. But it’s ok now that I have a working method.

Hi,

Did you try using the ‘changed’ handler on the text field. When there is a change in the text field, then you might change the content of a data cell. Something like this:

on changed theObject – the text field
set c to (content of theObject) as string
set content of data cell 1 of data row 1 of data column “Job Name” of theDataSource to c
end changed

You probably did this, then disregard.

gl,

That’s what I’m currently doing. Actually, I’m using the “end editing” handler. Amounts to the same thing though. I’m just hoping to be able to do it all without coding everything again.

Thanks,
Brad Bumgarner, CTA