Re: creating draggable NSView
Re: creating draggable NSView
- Subject: Re: creating draggable NSView
- From: Jeff Evans <email@hidden>
- Date: Wed, 03 Feb 2016 16:46:48 -0800
OK, cancel that. As so often happens when I finally give up and ask a question, the answer hit me the face a few minutes later.
Still hurts, too: trouble was that in an earlier experiment I had overridden setFrame: in this derived class and had neglected to remove that - it was not configured to do anything yet... now we return to our regular programming.
With deepest apologies, Jeff
On Feb 3, 2016, at 4:28 PM, Jeff Evans wrote:
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 (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
--
If this email is spam, report it to
https://support.onlymyemail.com/view/report_spam/MTAxOTYyOjE4NDk0ODk5NTM6amV2YW5zQGFycy1ub3ZhLmNvbTpkZWxpdmVyZWQ
_______________________________________________
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