Hi Peter,

You'll note my code says nothing about first responder, so you should get whatever the table view is set to do. In my use of this code, my table view is actually in a floating window and I've set it only to become key if needed - and so for changing selection or toggling checkboxes, it doesn't.

Your situation sounds a bit different so I haven't tested for it, but note that for all other columns, I call [super mouseDown:...] so I would think that you should get completely normal behaviour for these columns.

I think what you're saying is that the view is focused before you get the mouseDown: passed to you, so it focuses the table before you get a chance to handle the checkbox (and prevent focusing). That being the case you could turn the problem on its head - set the table view to refuse first responder generally, then in the mouseDown: method deliberately make it the first responder if the mouse hits any of the other columns. No idea if this will work, but worth a try?

As an aside: I also use this code for a simple UI to a drawing program's layers - I found that letting the table grab focus unless it's actually editing the layer's name exceedingly annoying - it takes focus away from the drawing content view itself, which gets old very fast. So setting the table to never accept focus (unless editing) is much more usable, I found. If you still want a decent strong highlight for the selected layer rather than a washed-out grey then you can override other bits of the table view to draw it however you want.

G.


On 20 Apr 2008, at 5:06 pm, Peter Zegelin wrote:
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


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to