Mike
On Mar 10, 2009, at 5:41 PM, Jesper Storm Bache wrote:
When you modify a window it registers itself as needing redrawing in the current run loop.If you are performing active tracking, you may have to do so yourself.Try calling [window flushWindowIfNeeded] on your window at the end of your loop (inside the loop).What is the reason for your explicit tracking?You should be able to simply listen for mouseDragged, mouseDown, and mouseUp on your split view (if this is a custom sub-class).Jesper Storm Bache On Mar 10, 2009, at 2:51 PM, Mike Manzano wrote:Hi, I am tracking the mouse pointer to dynamically resize a splitter as a separate drag handle is dragged. This is done in mouseDown: of the drag handle with a custom event loop. The loop looks like this: while (keepOn) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; theEvent = [[self window] nextEventMatchingMask: NSAnyEventMask] ;// NSLeftMouseUpMask | NSLeftMouseDraggedMask]; switch ([theEvent type]) { case NSLeftMouseUp: keepOn = NO; break; case NSLeftMouseDragged:[nc postNotificationName:NSSplitViewWillResizeSubviewsNotificationobject:splitView]; firstFrame = [[[splitView subviews] objectAtIndex:0] frame]; firstFrame.size.width = (isLeftResizer ? MAX(0,roundf(([splitViewconvertPoint:[theEvent locationInWindow] fromView:nil].x + offset) - firstFrame.origin.x)) : MAX(0,roundf([splitViewconvertPoint:[theEvent locationInWindow] fromView:nil].x - [splitViewdividerThickness] - offset))); firstFrame.size.width = MIN(MAX(firstFrame.size.width,min),max); NSLog( @"SetFrame: %@" , NSStringFromRect(firstFrame) ) ; [[[splitView subviews] objectAtIndex:0] setFrame:firstFrame]; NSLog( @"\tIs Now: %@" , NSStringFromRect([[[splitView subviews] objectAtIndex:0] frame]) ) ; [splitView adjustSubviews]; [nc postNotificationName:NSSplitViewDidResizeSubviewsNotification object:splitView]; break; default: break; } [pool release] ; } NSLog( @"Finally: %@" , NSStringFromRect([[[splitView subviews] objectAtIndex:0] frame]) ) ; (you might recognize this is as the Scrivener custom split view code available on the web) Anyway, the visual updates to the screen seem to start lagging the further right I drag the handle. You can see the NSLog()s I have in the code; here is the output as I drag: [...]2009-03-10 14:37:42.428 SkootUI[8830:10b] SetFrame: {{0, 0}, {718, 604}} 2009-03-10 14:37:42.444 SkootUI[8830:10b] Is Now: {{0, 0}, {718, 604}} 2009-03-10 14:37:42.511 SkootUI[8830:10b] SetFrame: {{0, 0}, {721, 604}} 2009-03-10 14:37:42.539 SkootUI[8830:10b] Is Now: {{0, 0}, {721, 604}} 2009-03-10 14:37:42.596 SkootUI[8830:10b] SetFrame: {{0, 0}, {723, 604}} 2009-03-10 14:37:42.600 SkootUI[8830:10b] Is Now: {{0, 0}, {723, 604}} 2009-03-10 14:37:44.101 SkootUI[8830:10b] Finally: {{0, 0}, {684, 604}}As you can see, as far as the view being resized is concerned, it is being set to what I set it to as I drag the handle; i.e., the "SetFrame:" dimensions match the "Is Now:" dimensions. During this time, however, I can see the view sizing visually lag. When the dragfinishes and the "Finally" block prints out, querying the view for itsframe displays what I believe to be the actual lagged dimensions. Can anyone tell me what's going on? Thanks, Mike _______________________________________________ Cocoa-dev mailing list ([email protected]) 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/jsbache%40adobe.com This email sent to [email protected]
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list ([email protected]) 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]
