Re: lockFocus and unlockFocus not really working at drag-time???
Re: lockFocus and unlockFocus not really working at drag-time???
- Subject: Re: lockFocus and unlockFocus not really working at drag-time???
- From: Eric Morand <email@hidden>
- Date: Sun, 12 Mar 2006 23:35:18 +0100
I have the exact same problem and I'd be glad if someone could give
us some hints.
Or maybe, Theodore, you have since found the answer ?
Eric.
Le 16 janv. 06 à 18:31, Theodore H. Smith a écrit :
I'm trying to do something really really really really really simple.
I just want to draw a drag focus ring in a window. Just like the
Finder does when you drag a file from one window to another.
The focus ring must be drawn in an WebView object, because I have a
WebView that will display html files.
So it makes sense that I want to drag and drop html files into a
WebView, correct?
But it's just not working.
I got this code:
-(void) DrawRing {
if ( ! [self lockFocusIfCanDraw] ) {
return;
}
NSColor* color = [NSColor blueColor];
NSRect rFrame = [self frame];
NSSize rSize = rFrame.size;
[color set];
NSBezierPath* bza = [NSBezierPath bezierPath];
[bza moveToPoint:NSMakePoint(0.0,0.0)];
[bza lineToPoint:NSMakePoint(rSize.width,0.0)];
[bza lineToPoint:NSMakePoint(rSize.width,rSize.height)];
[bza lineToPoint:NSMakePoint(0.0,rSize.height)];
[bza lineToPoint:NSMakePoint(0.0,0.0)];
[bza setLineWidth:2.0];
[bza setLineJoinStyle:NSRoundLineJoinStyle];
[bza closePath];
[bza stroke];
[self unlockFocus];
// [self display];
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
SetThemeCursor(kThemeCopyArrowCursor);
NSDragOperation d = [self draggingTest:sender];
if (d == NSDragOperationGeneric) {
[self DrawRing];
}
return d;
}
What happens is this:
When I drag a file, NO ring is displayed. If I then drag the file
out of the window and release it (or press escape during the drag),
thus cancelling the drag, then something funny happens.
The ring is drawn!
But the ring is NOT drawn during the drag, only AFTER the drag.
Despite that I drew the ring DURING the drag?
How can I get the drawing to happen immediately? Instead of at a
later date?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden