On Jul 20, 2012, at 19:03 , Keary Suska wrote:

> In an NSTableView I am providing custom cells via 
> tableView:dataCellForTableColumn:row:, based on values represented in other 
> columns. The cell is usually determined when a value is specified via 
> NSPopupButtonCells in two other columns. When an effecting value is changed, 
> I call reloadDataForRowIndexes:columnIndexes: to refresh the cell(s) in 
> question. The problem is that even thought the delegate method is properly 
> called to return the changed NSCell, the NSTableView will not redraw the cell 
> until the row is deselected or is refreshed by some other means--such as 
> obscuring the tableview with another window or clicking in the cell (but only 
> when it's data cell is editable). I have also tried calling 
> setNeedsDisplayInRect:, but that doesn't work either.
> 
> Oddly, it seems to work fine when called from an action method assigned to 
> the NSMenuItems level of a particular NSPopupButtonCell, but not when called 
> from an action method assigned to the NSPopupButtonCell itself. Although I 
> did try to specify the action for the individual NSMenuItems in the other 
> popup, but that didn't work either. The main difference between the two is 
> that one is specified via Interface Builder and the other is generated in 
> code.


> - (IBAction)selectComparator:(id)sender
> {
>  // clear operand
>  [[self clauseExpressionForRow:[queryTableView selectedRow]] 
> setOperand:[ClauseOperand nullOperand]];
> 
>  // comparator changes may change operand displays
>  [queryTableView reloadDataForRowIndexes:[NSIndexSet 
> indexSetWithIndex:[queryTableView selectedRow]] columnIndexes:[NSIndexSet 
> indexSetWithIndex:4]];
> }

So, to clarify, when it fails, are you saying:

1. It doesn't get to 'selectComparator:'.

2. It gets there, but 'dataCellForTableColumn:' doesn't get called for column 4 
(at least, not until later, at the point where the row really redraws).

3. It gets to 'dataCellForTableColumn:' for the right row/column combinations 
at the expected time, but the display just doesn't redraw.

?

What happens if you simply 'reloadData' instead of trying to be specific, 
and/or what happens if you simply 'setNeedsDisplay:' instead of trying to be 
specific?

Also, I notice that if '[queryTableView selectedRow]' isn't what you are 
expecting, when 'selectComparator:' is called, you'd get precisely the behavior 
you describe.
_______________________________________________

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

This email sent to arch...@mail-archive.com

Reply via email to