• 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
Re: lockFocus and unlockFocus not really working at drag-time???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Mon, 13 Mar 2006 08:51:45 +0100

Thanks John.

It doesn't appear to work but I have found that the the display method send a flushWindow message to the window. So, all I had to do was to send a flushWindow message to my window after having drawn whatever I needed in my view.



Again, thanks for your help,


Eric.


Le 13 mars 06 à 00:21, John Pannell a écrit :

Hi Eric-

I think the problem is that the drag sets the application into the NSEventTrackingRunLoopMode and all of the drawing commands are queued up in NSDefaultRunLoopMode until the mouse is released. I have a view that performs animation during a drag, and used a timer (created right before the dragImage:at:offset:event:pasteboard:source:slideBack: method) to fire and initiate drawing in the proper run loop, using the runloop's performSelector:target:argument:order:modes: method. This situation doesn't need a timer, I wouldn't think.

In the case outlined below, I think you could replace the [self DrawRing] call in mouseEntered: with...

[[NSRunLoop currentRunLoop] performSelector:@selector(drawRing) target:self argument:nil order:1 modes:[NSArray arrayWithObjects:@"NSEventTrackingRunLoopMode", @"NSDefaultRunLoopMode", nil]];

The message would also have to be balanced with an "undrawRing" message in the mouseExited: method.

My knowledge of runloops, etc. is pretty shaky, but I believe that is what the original post is up against.

HTH!

John

John Pannell
Positive Spin Media
http://www.positivespinmedia.com


On Mar 12, 2006, at 3:35 PM, Eric Morand wrote:

I have the exact same problem and I'd be glad if someone could give us some hints.

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;
}


_______________________________________________ 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
References: 
 >Re: lockFocus and unlockFocus not really working at drag-time??? (From: Eric Morand <email@hidden>)
 >Re: lockFocus and unlockFocus not really working at drag-time??? (From: John Pannell <email@hidden>)

  • Prev by Date: Re: DateCreated in CoreData - Best Method?
  • Next by Date: Re: Embedding image data
  • Previous by thread: Re: lockFocus and unlockFocus not really working at drag-time???
  • Next by thread: Efficient way to composite large images?
  • Index(es):
    • Date
    • Thread