• 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: Implementing a Slightly Unusual NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implementing a Slightly Unusual NSTableView


  • Subject: Re: Implementing a Slightly Unusual NSTableView
  • From: Peter Zegelin <email@hidden>
  • Date: Sun, 20 Apr 2008 17:06:52 +1000

Hi Graham,

	This is great - worked like a charm first time. Many, many thanks!

The only thing I think I need to do now is to get the TableView to become first responder when I don't click on a checkbox. I think I'm nearly there as well. What I have done is make the tableview accept firstResponder and then added:

[[self window] makeFirstResponder:nil];

in the mousDown of the TableView - just before I begin tracking the cell. This prevents the tableView from becoming first responder unless I click on a normal column. Only problem of course is that the view that *was* the first responder now loses the focus. I tried:

[[self window] makeFirstResponder: [[self window] firstResponder]];

to see if I could set the firstResponder back to what it was, but by the time I've clicked on the table it is already the first responder.

Any suggestions how I could prevent my table from becoming first responder when I click on a checkbox using your code?

thanks again for your help,

Peter


On 20/04/2008, at 11:04 AM, Graham Cox wrote:

Hi Peter,

I have solved this problem in the past (under Tiger, same code still works fine on Leopard) and here's what I did - it may not be completely generic but it but should give you the general idea. There might be an easier/cleaner/better way to do it, but it did the trick for me. On Leopard only I think there's more built-in support for this.

I had to subclass both NSTableView and the checkbox cell:

<snip>



hope this is useful,

G.


On 19 Apr 2008, at 8:05 pm, Peter Zegelin wrote:
I have a tableview representing the layers of a drawing application. The tableview has several columns of checkboxes, some status columns and an editable text column for the layer name. The rows of the tableview are selectable (multiple selection) so they can be reordered and cut, copied and pasted. I have everything except row reordering working fine ( and this isn't a problem - so far!).

However as things currently are, every time a checkbox is clicked on the row is selected as well, and the focus is shifted away from my drawing view to this tableview. What I would really like to happen is that if a user clicks on a checkbox then the row is *not* selected at all and only if they click elsewhere would the tableview select the row and get the focus. Even though the checkbox columns are quite narrow there is still quite a bit of space where the checkbox isn't affected and a couple of columns show only status info so could be used to select the row.

The problem is I'm pretty new to Cocoa and haven't clue where to start with this. Any suggestions how I might go about it would be much appreciated.

thanks!

Peter
_______________________________________________

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


_______________________________________________

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: Implementing a Slightly Unusual NSTableView
      • From: Graham Cox <email@hidden>
References: 
 >Implementing a Slightly Unusual NSTableView (From: Peter Zegelin <email@hidden>)
 >Re: Implementing a Slightly Unusual NSTableView (From: Graham Cox <email@hidden>)

  • Prev by Date: KVO and Object Arrays
  • Next by Date: My private problems
  • Previous by thread: Re: Implementing a Slightly Unusual NSTableView
  • Next by thread: Re: Implementing a Slightly Unusual NSTableView
  • Index(es):
    • Date
    • Thread