Changeset [f63a6bf01e74b301dc576e647c49dadb82c56a4a] by rentzsch

November 20th, 2009 @ 08:40 PM

[NEW] CPTableView supports editing textual cells.

Needs

  • Your data source must respond to -tableView:setObjectValue:forTableColumn:row:.

  • Your CPTableColumn must be set as editable.

  • If specified, your delegate must return YES from its optional -tableView:shouldEditTableColumn:row: method (duh).

Yays

  • Implements spatial slop (tolerates mouse moving slightly (up to 5px) during mouseDown).

  • Like Cocoa, edit-invocation is impatient (mouseDown-and-hold past 1s isn't considered a "I want to edit this cell" click).

The 5px CLICK_SPACE_DELTA and 1s CLICK_TIME_DELTA values are stolen/copied from AppKit/Platform/DOM/CPPlatformWindow+DOM.j -- it would be nice if those constants were exposed or something to DRY things up.

Nays

  • I'm having trouble getting the cell to act like Cocoa upon edit-initiation. Currently the editing insertion point appears at the end of the text, where in Cocoa the entire cell's text is selected. I explicitly call [dataView selectText:nil], but that doesn't do the trick.

  • Background color of the selected+edited cell doesn't change, like in Cocoa. It should go black-text-on-white for the cell that's being edited.

  • Will likely blow up on custom data views that aren't CPTextFields or a subclass thereof. I send CPTextField-specific messages to the data view like -setSelectable: and -selectText:. It's easy to stick in a -respondsToSelector: in there, but I don't want to put that in until we have real-world cases. Blowing up is better than silent why-isn't-my-custom-view-working? wild-code-hunts.

  • Cursor doesn't blink until you start some serious editing.

  • Hard to read black text against current dark background. Seems more like a theme issue than anything, but my next commit will lighten things up as a band-aid. http://github.com/280north/cappuccino/commit/f63a6bf01e74b301dc576e...

Committed by rentzsch

  • M AppKit/CPTableView.j
New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Cappuccino Web Framework, including AppKit, Foundation, and Objective-J.

Shared Ticket Bins