Re: Implementing a Slightly Unusual NSTableView

2008-04-21 Thread Corbin Dunn
I seem to recall that in 10.5 there is new API, either in NSTableView or NSActionCell, that makes this easy to do; but I just looked through both headers and can't find it. Does anyone else remember? Yeah, I remember. The DragNDropOutlineView demo shows how. Basically, you implement: -

Re: Implementing a Slightly Unusual NSTableView

2008-04-21 Thread Peter Zegelin
Thanks Graham - I have updated my code as well. I also think I solved the focus problem. Tried most of the responder methods without luck so I took a different tack. I realized that I would only have 3 views that could grab the focus so I created a global variable 'currentResponder' (will

Re: Implementing a Slightly Unusual NSTableView

2008-04-20 Thread Graham Cox
I just noticed a bug in the code I posted - it should be: - mouseDown: ... if ([dataCell trackMouse:event inRect:cellFrame ofView:self untilMouseUp:YES]) { // call the datasource to handle the checkbox state change as normal [[self dataSource] tableView:self setObj

Re: Implementing a Slightly Unusual NSTableView

2008-04-20 Thread Peter Zegelin
On 20/04/2008, at 7:28 PM, Graham Cox wrote: 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

Re: Implementing a Slightly Unusual NSTableView

2008-04-20 Thread Graham Cox
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 checkbo

Re: Implementing a Slightly Unusual NSTableView

2008-04-20 Thread Peter Zegelin
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

Re: Implementing a Slightly Unusual NSTableView

2008-04-19 Thread Graham Cox
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

Re: Implementing a Slightly Unusual NSTableView

2008-04-19 Thread Jens Alfke
On 19 Apr '08, at 3:05 AM, Peter Zegelin wrote: 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

Implementing a Slightly Unusual NSTableView

2008-04-19 Thread Peter Zegelin
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 a