Hi all,
I am trying a simple application using NSArrayController and cocoa bindings. The application contains - a table with only one column, two buttons "+, -" to add and delete records, two text fields to show count of records entered and sum of these records.
To allow user to enter numbers only, I have assigned NSNumberFormatter to the NSTextField cell.
The model class: "Transaction" contains only one property: "amount". I have used @property and @synthesize to declare and define its accessor methods.
So in all, I want to perform following task:
- Allowing user to insert, edit, modify numbers in each row in table.
- Displaying count of records entered in a text field.
- Displaying aggregate of numbers entered in other text field.
I am able to achieve 1st pt. via cocoa bindings but when I tried to implement 2nd and 3rd pt., it is not working as intended.
I did following things for 2nd and 3rd pt.
for 2nd pt.... 1. In binding preference of a text field. I am binding value to array controller. 2. Setting model key path as @count.amount
for 3rd pt.... 1. In binding preference of a text field. I am binding value to array controller. 2. Setting model key path as @sum.amount
Can anyone suggest me where I may be wrong or some other way to achieve my requirements??
Thanks,
Miraaj