• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cells within cells part 2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cells within cells part 2


  • Subject: Re: Cells within cells part 2
  • From: Shaun Wexler <email@hidden>
  • Date: Mon, 28 Jul 2003 01:05:21 -0700
  • Resent-date: Mon, 28 Jul 2003 01:05:58 -0700
  • Resent-from: Shaun Wexler <email@hidden>
  • Resent-message-id: <email@hidden>
  • Resent-to: email@hidden

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.
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
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.
  • Follow-Ups:
    • Re: Cells within cells part 2
      • From: "Douglas A. Welton" <email@hidden>
  • Prev by Date: Re: Toolbars, controllers, and delegates
  • Next by Date: Re: plotting data
  • Previous by thread: Cells within cells part 2
  • Next by thread: Re: Cells within cells part 2
  • Index(es):
    • Date
    • Thread