How can I make an NSTableView update its display on command?
How can I make an NSTableView update its display on command?
- Subject: How can I make an NSTableView update its display on command?
- From: Daniel Wambold <email@hidden>
- Date: Sat, 26 Dec 2009 09:04:49 -0500
Hello List,
I am writing a CoreData app with an entity controller bound to an NSTableView, with the bindings created programmatically. Periodically, the program creates a new NSManagedObject, sets default values, and adds it to the MOC. This works fine. However, the NSTableView does not update its display until I mouse over it. In a given period of time, several objects may have been added, but they do not appear until the pointer enters the NSTableView onscreen. I have tried each of the following, then commented them out when they failed:
NSLog (@"Have we updated yet?\n");
// 1 // [myTableViewOutlet reloadData];
// 2 // [myTableViewOutlet lockFocus];
// [myTableViewOutlet display];
// [myTableViewOutlet unlockFocus];
// 3 // [myTableViewOutlet viewWillDraw];
// 4 // [myTableViewOutlet lockFocus];
[myTableViewOutlet drawRect:[myTableViewOutlet bounds]];
[myTableViewOutlet unlockFocus];
// 5 // [[myTableViewOutlet superview] setNeedsDisplay:YES];
// 6 // [myTableViewOutlet lockFocus];
// NSRect myTableViewNewRowRect = [myTableViewOutlet rectOfRow:([myTableViewOutlet numberOfRows]-1)];
// [myTableViewOutlet drawRow:([myTableViewOutlet numberOfRows]-1) clipRect:myTableViewNewRowRect];
// [myTableViewOutlet unlockFocus];
// 7 // [myTableViewOutlet scrollRowToVisible:([myTableViewOutlet numberOfRows]-1)];
Any hints on how to make this view update itself on command. I realize its deferred updating is probably the result of the runtime trying to be efficient, but these new object events only occur about once every 5 minutes, and the end user is not going to understand why none appear for a while, then a whole bunch suddenly pop into view when they move the mouse.
Thanks!
-Dan_______________________________________________
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