Can an NSControl (tableview) track focus on individual cells? (was:Tabbing to NSPopUpButtonCells in a table?)
Can an NSControl (tableview) track focus on individual cells? (was:Tabbing to NSPopUpButtonCells in a table?)
- Subject: Can an NSControl (tableview) track focus on individual cells? (was:Tabbing to NSPopUpButtonCells in a table?)
- From: George Orthwein <email@hidden>
- Date: Fri, 11 May 2007 14:35:36 -0400
Can an NSControl (tableview) track focus on its individual cells? I'm
thinking No... or at least, not without a bunch of custom code.
Desired Behavior: Tab through the cells of an NSTableView just like
Full Keyboard Access lets you tab through the controls in your
window. This works for NSTextFieldCells but any other cell type is
skipped. The reason it works for text cells seems to be a special
case with the field editor....
Realization: The Table View is a single control with a bunch of cells
inside it. When you click in it, the table view is the first
responder, not a particular cell. The Key View Loop is a series of
NSViews... and the NSCells in the table don't inherit from NSView so
they can't be a part of it.
So what about text cells? When you edit text field cells, they appear
to have focus and you can tab to the next text field cell. Their
"focus" is somewhat an illusion because editing the cell brings up
the field editor which is a shared NSTextView instance. The field
editor can have its own focus since it actually *is* a separate
control/view from the table.
I'm not completely sure how the Tab key works here, but the next cell
to edit is picked in NSTable's textDidEndEditing method. I'm not sure
what the criteria is exactly, just the next NSTextFieldCell? Or
perhaps, the next Text-based NSCell? (initTextCell vs. initImageCell?)
I did find some examples of overriding textDidEndEditing...
http://www.cocoabuilder.com/archive/message/cocoa/2002/11/1/70749
I was able to tab out of an NSTextFieldCell and then trigger the next
NSPopUpButtonCell using performClickWithFrame:inView: to open its
menu. However, what I really want is the popup to highlight first and
then if the user hits space, the menu will open (like Full Keyboard
Access does on NSPopUpButton controls).
So I guess I would need to maintain my own "focus" cell... highlight
it possibly in willDisplayCell... and then direct most keypresses to
that cell while tabbing would move the focus. Perhaps do-able, but
not exactly the built-in functionality that I was hoping for.
Or maybe there is a way to implement NSCell editing methods in my
NSPopUpButtonCell class so that it becomes a target for "next editing
cell" when tabbing out of a text field cell? I implemented a bunch of
likely methods but none of them got called (acceptsFirstResponder,
isEditable, editWithFrame:..., etc).
Am I Totally-Off-The-Markā¢ here? If not, I think I will make a
feature request.
Thanks,
George_______________________________________________
Cocoa-dev mailing list (email@hidden)
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