• 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: click in NSButtonCell in NSTableView without selecting table row? [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: click in NSButtonCell in NSTableView without selecting table row? [SOLVED]


  • Subject: Re: click in NSButtonCell in NSTableView without selecting table row? [SOLVED]
  • From: Dan Rowley <email@hidden>
  • Date: Tue, 28 Apr 2009 11:03:31 -0700
  • Thread-topic: click in NSButtonCell in NSTableView without selecting table row? [SOLVED]

Thanks, Corbin - to summarize for posterity, the implementation of

- (BOOL)outlineView:(NSOutlineView *)ov shouldSelectItem:(id)item

is using -clickedColumn and -clickedRow to determine the location of the
click, and not selecting the row (returning NO) if the cell in that location
is an enabled NSButtonCell.  I had originally discarded this approach
because of this line in the documentation for -clickedColumn:

" The return value of this method is meaningful only in the target¹s
implementation of the action or double-action method."

Apparently this statement is no longer true.

Thanks for the help!

Dan



On 4/27/09 6:17 PM, "Corbin Dunn" <email@hidden> wrote:

> On Apr 27, 2009, at 1:43 PM, Dan Rowley wrote:
>
>> Hello - I've done multiple searches and seen this topic discussed,
>> but none with a solution that doesn't feel like a hack.  I have an
>> NSTableView, and one column that contains an NSButtonCell.  I would
>> like the user to be able to interact with this cell without the
>> selection in the table changing.  In the documentation for -
>> tableView:shouldTrackCell:forTableColumn:row: , it says "For
>> example, this allows you to have an NSButtonCell in a table which
>> does not change the selection, but can still be clicked on and
>> tracked," yet I'm not exactly sure how to actually achieve this end.
>>
>> I return YES from the delegate method, then indeed my button works
>> correctly (the data source gets the expected setObjectValue
>> message), but the selection of the table also changes.  The obvious
>> first solution is to override tableView:shouldSelectRow:, yet this
>> gets sent BEFORE shouldTrackCell, so I'm not really sure where to go
>> from here. Do I have to gawk at the current mouse event in
>> shouldSelectRow: and return NO if it appears that the mouse went
>> down in the button cell?  This feels harder than it ought to be.
>>
>> Am I missing something painfully obvious?
>
> the DragNDropOutlineView example does this on Leopard. If after
> checking it out you still have questions, then please repost.
>
>
> corbin
>
>


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: click in NSButtonCell in NSTableView without selecting table row? [SOLVED]
      • From: Corbin Dunn <email@hidden>
References: 
 >Re: click in NSButtonCell in NSTableView without selecting table row? (From: Corbin Dunn <email@hidden>)

  • Prev by Date: Re: NSDateFormatter for ISO8601
  • Next by Date: Re: Storing a table view in user defaults
  • Previous by thread: Re: click in NSButtonCell in NSTableView without selecting table row?
  • Next by thread: Re: click in NSButtonCell in NSTableView without selecting table row? [SOLVED]
  • Index(es):
    • Date
    • Thread