Re: Are there any way to update NSPanel content during dragging the panel ?
Re: Are there any way to update NSPanel content during dragging the panel ?
- Subject: Re: Are there any way to update NSPanel content during dragging the panel ?
- From: Yoshiaki Katayanagi <email@hidden>
- Date: Sat, 05 May 2012 13:09:48 +0900
> My custom NSView in a NSPanel shows some information depends on panel's position to the main window. I want to update it during dragging the panel. I try [self setNeedsDisplay:YES] in mouseDragged: delegate, drawRect: called many times during dragging, but it will not appear on screen until mouse stop.
> I test it on Mac OS X 10.7 and want to support 10.6.
Found the solution. Simply, drag the panel by my self. Following code in the custom view do this.
- (void)mouseDown:(NSEvent*)event {
offset = [event locationInWindow];
}
- (void)mouseDragged:(NSEvent *)event {
NSPoint location = [NSEvent mouseLocation];
location.x -= offset;
location.y -= offset;
[[self window] setFrameOrigin:location];
[self setNeedsDisplay:YES];
}
Thanks.
Yoshiaki Katayanagi
http://www.jizoh.jp/english.html
_______________________________________________
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