• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
lockFocus and unlockFocus not really working at drag-time???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lockFocus and unlockFocus not really working at drag-time???


  • Subject: lockFocus and unlockFocus not really working at drag-time???
  • From: "Theodore H. Smith" <email@hidden>
  • Date: Mon, 16 Jan 2006 17:31:39 +0000

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


  • Prev by Date: Re: Obj-C from JavaScript, Google Map event listeners in a WebView.
  • Next by Date: Re: Another newbie EXC_BAD_ACCESS in C
  • Previous by thread: Re: Obj-C from JavaScript, Google Map event listeners in a WebView.
  • Next by thread: Q: "Linking" to mail messages?
  • Index(es):
    • Date
    • Thread