NSOutlineView not redrawing
Posted
by Septih
on Stack Overflow
See other posts from Stack Overflow
or by Septih
Published on 2010-05-04T13:18:50Z
Indexed on
2010/05/04
14:58 UTC
Read the original article
Hit count: 237
Hello,
I have an NSOutlineView with checkboxes. I have the checkbox state bound to a node item with the key shouldBeCopied. In the node item I have the getters and setters like so:
-(BOOL)shouldBeCopied {
if([[self parent] shouldBeCopied])
return YES;
return shouldBeCopied;
}
-(void)setShouldBeCopied:(BOOL)value {
shouldBeCopied = value;
if(value && [[self children] count] > 0)
[[self delegate] reloadData];
}
The idea here is that if the parent is checked, so should the children. The problem I'm having is that when I check the parent, it does not update that view of the children if they are already expanded. I can understand that it should not be updated by the bindings because i'm not actually changing the value. But should reloadData not cause the bindings to re-get the value, thus calling -shouldBeCopied
for the children? I have tried a few other things such as -setNeedsDisplay
and -reloadItem:nil reloadChildren:YES
but none work. I've noticed that the display gets refreshed when I swap to xcode and then back again and that's all I want, so how do I get it to behave that way?
© Stack Overflow or respective owner