Colleagues, I have been trying to create a draggable NSView for OSX and am 
stumped by the stubborn refusal of the view frame to change.

Here's the essence: in responding to a mouse drag there is a place where I do 
this;

NSPoint newLocation = event.locationInWindow;
NSRect frame = self.frame;
frame.origin = newLocation;
[self setFrame: frame];
[self setNeedsDisplay: YES];

I can also do [self.superview setNeedsDisplay: YES];

However, nothing moves, and looking at this in the debugger I can see that 
self.frame is not altered  by [self setFrame: frame];
Suppose the original frame is 100,100,200, 200
and the new location is 101,105
The new frame is thus 101,105,200,200
And yet if I then look at self.frame in the debugger by adding to the above
frame = self.frame;


I see it is still what it was before: 100,100,200,200. Apparently the call to 
setFrame had no effect.

I am not using IB. This is all programmatic. Does anyone have a clue as to why 
that frame would not alter after setFrame: with a new value?

Thanks, Jeff



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to