Re: Need the Why and How of mouseDragged:
Re: Need the Why and How of mouseDragged:
- Subject: Re: Need the Why and How of mouseDragged:
- From: Jerry Krinock <email@hidden>
- Date: Thu, 13 Dec 2007 09:37:36 -0800
Thanks to Alastair and to Adam for the code. But I now have seen
exactly the same behavior in another instance of this same custom
control(*), which is not in an RBSplitView. So it looks like
RBSplitView is not my problem, at least not yet.
I have found that I get -mouseDragged: if either:
(1) I do NOT invoke super in my -mouseDown: implementation
or (2) I send it -setEnabled:NO
So, using the above knowledge I can get the behavior I want. But it
makes absolutely no sense. In particular, -setEnabled documentation
implies the opposite effect. But I've now repeated these experiments
many times. Also, I do not use the value of -isEnabled in my custom
control implementation. So this does not appear to be a side-effect
of other code.
From this code:
- (void)mouseDragged:(NSEvent *)event {
NSLog(@"I have received mouseDragged") ;
NSLog(@"My enabled state is: %d", [self isEnabled]) ;
...
}
I get this console log:
2007-12-13 09:21:45.841 Bookdog[10173:10b] I have received mouseDragged
2007-12-13 09:21:45.842 Bookdog[10173:10b] My enabled state is: 0
From -[NSControl setEnabled:] documentation...
"YES if you want the receiver to react to mouse events; otherwise, NO."
The logged result seems contrary to documentation. Can anyone explain
this? I'm worried that I'm coding myself into a dark alley.
Jerry Krinock
(*) In my original post, I called this a custom view, an NSView*
subclass. More specifically, it is a custom control, an NSControl*
subclass.
_______________________________________________
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