Re: rightMouseDown: never called in NSView subclass

2011-08-26 Thread Indragie Karunaratne
Thank you for this tip, I had tried doing this earlier, but I was using -hitTest: from my NSWindow to find out if the event should be passed to my view, which obviously didn't work because NSToolbarView was overriding -hitTest: to return itself. I got it working by converting point to the view's

Re: rightMouseDown: never called in NSView subclass

2011-08-26 Thread Lee Ann Rucker
What if you intercept the event a bit higher, in [NSWindow sendEvent:]? The right click gets intercepted by the toolbar view because it's got its own menu; it's likely your users won't discover your menu because they're expecting that one. I have toolbar items with menus, but they're NSButtons t

Re: rightMouseDown: never called in NSView subclass

2011-08-26 Thread Kyle Sluder
On Fri, Aug 26, 2011 at 10:36 AM, Kyle Sluder wrote: > replace NSClipView's implementation Of course I mean NSToolbarView. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to

Re: rightMouseDown: never called in NSView subclass

2011-08-26 Thread Kyle Sluder
On Fri, Aug 26, 2011 at 9:51 AM, glenn andreas wrote: > The App Store approval guidelines is pretty clear that the use of non-public > API is grounds for rejection.  NSToolbarView is undocumented, and therefore > doing anything that depends on that class or its (undocumented) behavior > would s

Re: rightMouseDown: never called in NSView subclass

2011-08-26 Thread Mark Munz
OK, I misread your first message. That said, I'd go with the option to just put your "toolbar" view as part of the contentView of the window. If your view is within the contentView of the window, it will be part of the fullscreen window in Lion. Just make sure it can resize with the window. Xcode

Re: rightMouseDown: never called in NSView subclass

2011-08-26 Thread glenn andreas
The App Store approval guidelines is pretty clear that the use of non-public API is grounds for rejection. NSToolbarView is undocumented, and therefore doing anything that depends on that class or its (undocumented) behavior would seem like grounds for rejection. This would include adding a ca

Re: rightMouseDown: never called in NSView subclass

2011-08-26 Thread Indragie Karunaratne
Thats actually what I'm doing right now, its an NSToolbarItem with a custom view but like I said, the right mouse events are not passed to it by NSToolbarView without that little hack. I could, as you said, circumvent NSToolbar completely, but when a view is placed outside of the toolbar, it di

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Mark Munz
The description of what you're trying to do is a bit vague, but couldn't you just create an NSToolbarItem with a custom view? You might need to do a few tweaks if it needs to resize with the window, but that sure seems easier than trying to circumvent the framework as you are describing. You'd be a

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
Is there any other way to do this aside from what I'm doing right now? As far as I know, I have two choices: a) Use this method and risk something breaking b) Write an NSToolbar clone I know the risks, but if I could get this to pass through Mac App Store submission then I'd rather deal with po

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Quincey Morris
Ah, well, yes, if IB doesn't expose the class you need, that makes subclassing impractical. But in that case, replacing the NSToolbarView method seems even more undesirable. On Aug 25, 2011, at 20:55 , Indragie Karunaratne wrote: > I'm not sure how I would get NSToolbar to use my subclass of N

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
I'm not sure how I would get NSToolbar to use my subclass of NSToolbarView. I can't set the class of the toolbar *view* itself in IB (nor programatically, as far as I know), because NSToolbarView is a private class that NSToolbar uses to implement the UI. I can of course change the class of the

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Quincey Morris
On Aug 25, 2011, at 19:48 , Indragie Karunaratne wrote: > Based on Corbin's tip, I overrode -hitTest: on NSToolbarView to call NSView's > implementation instead and suddenly everything works. I expected something to > break in NSToolbarView from doing this, but I've tested pretty thoroughly and

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
Based on Corbin's tip, I overrode -hitTest: on NSToolbarView to call NSView's implementation instead and suddenly everything works. I expected something to break in NSToolbarView from doing this, but I've tested pretty thoroughly and there seem to be no issues. I don't know exactly how dangerous

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
This would make more sense if I explained what the view itself was. Long story short, it's a pretty huge (and important) custom control that runs all the way across the toolbar. There are other ways to access the commands (via the application menus + shortcuts) but I would also like to have a co

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Raleigh Ledet
A contextual menu in a toolbar? Lets think about this for a moment. A) such a command would be hard to discover. Your customers have other ways to activate the same commands right? If not, why not use a popup button here? B) I assume that's because you have an action tied to single click…. why no

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
I just need to present a contextual menu from my custom view toolbar item, but NSToolbarView is not passing the right mouse events down, so -menuForEvent: is never called. On 2011-08-25, at 4:27 PM, Corbin Dunn wrote: > ToolbarView overrides hitTest; to do some magic; that is probably the sourc

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Corbin Dunn
ToolbarView overrides hitTest; to do some magic; that is probably the source of your problem. What are you trying to do? corbin On Aug 25, 2011, at 3:14 PM, Indragie Karunaratne wrote: > Just realized something interesting, and remembered a key detail that I > forgot to mention. The view in q

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
Just realized something interesting, and remembered a key detail that I forgot to mention. The view in question is a custom view inside the toolbar of the window. The NSToolbar by default has a contextual menu that appears when the customizable property is set to YES. However, even though there

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
Triple checked, I even copy/pasted the method directly from the docs to make sure: - (void)rightMouseDown:(NSEvent *)theEvent { NSLog(@"right mouse"); [super rightMouseDown:theEvent]; } Could it be something to do with the fact that it's a layer hosting view? I don't see how that would

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Ken Thomases
On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne wrote: > I have an NSView subclass that I'm trying to capture right clicks in. I > override the rightMouseDown: method but it is never called. Any chance you simply have a typo or misspelling in your method signature? -Ken __

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
I'm on Lion, and I did find this bit in the AppKit Release Notes: NSView now passes unhandled -rightMouseDown: events up the responder chain Prior to 10.7, NSView did not pass unhandled -rightMouseDown: events up the responder chain. On 10.7, NSView passes -rightMouseDown: up the responder chain

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Kyle Sluder
On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne wrote: > I have an NSView subclass that I'm trying to capture right clicks in. I > override the rightMouseDown: method but it is never called. This is the first > time I've come across this issue as it has always worked fine for me before.

rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
I have an NSView subclass that I'm trying to capture right clicks in. I override the rightMouseDown: method but it is never called. This is the first time I've come across this issue as it has always worked fine for me before. All of the other mouse event methods (mouseDown:, mouseUp:, mouseDrag

rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
I have an NSView subclass that I'm trying to capture right clicks in. I override the rightMouseDown: method but it is never called. This is the first time I've come across this issue as it has always worked fine for me before. All of the other mouse event methods (mouseDown:, mouseUp:, mouseDrag