On 05/01/2011, at 6:32 PM, Abhijeet Singh wrote:

> Hi,I have a table view in my application. Table view has 3 columns. Items 
> (rows) in table view are added on Enter (return) key press on keyboard. 
> Column no 2 is editable and user needs to fill it. What I want to achieve is 
> when user press Enter key on key board:1. New row is added in table view with 
> column 1 & 3 filled (by default)2. Column 2 cell should be in edit mode and 
> ready to accept the user input I have done the first step (1) but i am not 
> able to set the focus on column2 cell and make it editable on Enter key 
> press.One more thing that i want to do is on Delete key press on keyboard the 
> selected row in table view should be deleted. I can do it by putting a button 
> on screen and connecting it with Delete key but i don't want to use a button 
> on my screen.Any help will be appreciated.Thanks & RegardsAbhijeetDear 
> cocoadev ! Get Yourself a cool, short @in.com Email ID now!

To preselect the cell for editing, use:   [NSTableView 
-editColumn:row:withEvent:select:];

The problem with your approach is that you are subverting the usual meanings of 
the keypresses. Once the cell is editing, enter and delete will operate with 
their usual meanings within the text. You can change  this and have your users 
confused by the non-standard behaviour while editing, or accept it and have 
your users confused by the modality change between editing and adding/deleting 
rows. Either way, your users will be confused.

A better Ui is to simply have small + and - buttons to add and remove rows, and 
let the keyboard work normally. This is what Apple's own apps tend to do and 
most people follow that.

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to