Re: Cells within cells part 2
Re: Cells within cells part 2
- Subject: Re: Cells within cells part 2
- From: "Douglas A. Welton" <email@hidden>
- Date: Mon, 28 Jul 2003 15:34:22 -0400
Pete,
Check out the implementation of ImageAndTextCell in the example code for the
DragNDropOutlineView sample code. The multi-part cell contains a pretty
straightforward example of help to override
-selectWithFrame:inView:editor:delegate:start:length:
later,
douglas
---
on 7/28/03 4:05 AM, Shaun Wexler at email@hidden wrote:
>
On Sunday, July 27, 2003, at 07:51 PM, Pete Yandell wrote:
>
>
> I have a cell which contains two other cells: a check box
>
> (NSButtonCell) and a text field (NSTextFieldCell.)
>
>
>
> I'm using this custom cell to draw rows in an NSOutlineView.
>
>
>
> The problem I have is that double-clicking anywhere in my cell opens a
>
> field editor to edit the text. It would make a lot more sense if the
>
> double-clicking only worked when you double-click on the text field
>
> within my cell. (Accidentally double-clicking on the check box and
>
> having a field editor open over to the right of the mouse feels really
>
> odd!)
>
>
>
> The difficulty is that the double-click is handled by the
>
> NSOutlineView, not the by the cell itself. The NSOutlineView simply
>
> calls selectWithFrame:inView:editor:delegate:start:length: on the
>
> cell, so the cell has no way of preventing the editing if the
>
> double-click is in the wrong place.
>
>
>
> Short of doing some very serious subclassing of NSOutlineView, does
>
> anyone have any ideas on how to work around this?
>
>
Override -selectWithFrame:inView:editor:delegate:start:length: in your
>
custom 'PYCheckBoxAndTextFieldCell' class. Ignore the double-click if
>
it's not in the NSTextFieldCell's frame rect, otherwise allow the edit
>
(by forwarding the message to the NSTextFieldCell). It sounds like
>
you're not subclassing NSActionCell, but rather the NSTextFieldCell,
>
correct? Then just call -super instead.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.