On Sep 25, 2008, at 10:37 PM, Ken Thomases wrote:

On Sep 25, 2008, at 9:18 PM, Graham Cox wrote:

On 26 Sep 2008, at 10:24 am, Gerd Knops wrote:

I would like to use a key other than "tab" to advance to the next text field, so that users can use a numeric keypad to enter something like "11-22-33" and have 11, 22 and 33 end up in different text fields.


I'd suggest not using a different key from 'Tab', since that's very much hardwired into every Mac user.

Alternative, why not just detect when the field has the required number of characters and move to the next field automatically? For numeric entry this is much more user-friendly.

For implementing such a thing, see -[NSWindow selectNextKeyView:].

I know how to do that part. The tricky part is intercepting and filtering the '-' key. given field editors etc.

One approach I tried was to implement -validateValue:forKey:error: and intercept the key values of the fields I am interested in, testing for a '-' as last character, removing it and advancing to the next key field. That works (after setting the involved bindings to 'Continuously updates value' and 'Verify immediately'), but for some odd reason when the '-' character is entered that method is called twice, causing it to skip a field. I hoped to avoid having to also add connections for the individual views so that I can find the next key view for the key field in question, but it seems to be the least bothersome approach at that point.

Thanks

Gerd



        
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to