Forcing a cell's field editor to send control:textShouldEndEditing: when leaving a cell
Forcing a cell's field editor to send control:textShouldEndEditing: when leaving a cell
- Subject: Forcing a cell's field editor to send control:textShouldEndEditing: when leaving a cell
- From: "Chris Arnaiz" <email@hidden>
- Date: Tue, 11 Aug 2009 11:53:34 -0700
- Thread-topic: Forcing a cell's field editor to send control:textShouldEndEditing: when leaving a cell
Hi,
I've been struggling to control the behavior of a NSTableView while
editing cells.
The table is a simple ID number / description list.
Editing an existing entry is okay, but my problem is dealing with new
entries.
My goal is to prevent the user from leaving a cell (mouse click, tab
key, enter key, etc) before they provide a valid value for that entry.
I have a delegate with the control:textShouldEndEditing implemented
which checks the current cell value.
Everything works fine as long as the user actually starts editing the
cell (types something on the keyboard).
However, if the user creates a new entry and decides to leave the cell
before typing anything, the delegate method is not called and table view
allows the user to move to different cells (empty values are not valid
on the list).
When the user wants to create a new entry, I make an empty row and make
it the "edit target" programmitcally, using NSTableView's
editColumn:row:withEvent:select: method.
Is there a way to make the cell act as if the user edited the cell,
programmitcally (so the control:textShouldEndEditing: method will be
called even though the user didn't actually make any changes)?
Any help will be greatly appreciated,
Christopher
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden