In need of some help with NSToolbarItem

  • Greetings,
    I've been reading through some of the apple documentation and have a
    basic understanding of what needs to be done when creating an
    NSToolbarItem subclass that contains a custom view.

    What I'm not sure about is how to pass any mouse click events through
    to the custom view rather than have them handled by the NSToolbarItem.

    Currently the custom view contains an NSSlider and an NSTextField.

    Any help is greatly appreciated.

    Thanks,
    Matthew Delves
  • On Mar 4, 2008, at 1:55 PM, Matthew Delves wrote:

    > Greetings,
    > I've been reading through some of the apple documentation and have
    > a basic understanding of what needs to be done when creating an
    > NSToolbarItem subclass that contains a custom view.
    >
    > What I'm not sure about is how to pass any mouse click events
    > through to the custom view rather than have them handled by the
    > NSToolbarItem.
    >
    > Currently the custom view contains an NSSlider and an NSTextField.
    >
    > Any help is greatly appreciated.

    You do not need to take any special action here.  Mouse events will
    be passed to your view automatically.  Are you seeing something
    different?

    -Peter
  • On 05/03/2008, at 9:38 AM, Peter Ammon wrote:

    >
    > On Mar 4, 2008, at 1:55 PM, Matthew Delves wrote:
    >
    >> Greetings,
    >> I've been reading through some of the apple documentation and have
    >> a basic understanding of what needs to be done when creating an
    >> NSToolbarItem subclass that contains a custom view.
    >>
    >> What I'm not sure about is how to pass any mouse click events
    >> through to the custom view rather than have them handled by the
    >> NSToolbarItem.
    >>
    >> Currently the custom view contains an NSSlider and an NSTextField.
    >>
    >> Any help is greatly appreciated.
    >
    > You do not need to take any special action here.  Mouse events will
    > be passed to your view automatically.  Are you seeing something
    > different?

    What I'm seeing is that when I try to drag the NSSlider it will move
    the window instead. Is there a way to get around this?

    Thanks,
    Matthew Delves
  • On Mar 4, 2008, at 2:59 PM, Matthew Delves wrote:

    >
    > On 05/03/2008, at 9:38 AM, Peter Ammon wrote:
    >
    >>
    >> On Mar 4, 2008, at 1:55 PM, Matthew Delves wrote:
    >>
    >>> Greetings,
    >>> I've been reading through some of the apple documentation and
    >>> have a basic understanding of what needs to be done when creating
    >>> an NSToolbarItem subclass that contains a custom view.
    >>>
    >>> What I'm not sure about is how to pass any mouse click events
    >>> through to the custom view rather than have them handled by the
    >>> NSToolbarItem.
    >>>
    >>> Currently the custom view contains an NSSlider and an NSTextField.
    >>>
    >>> Any help is greatly appreciated.
    >>
    >> You do not need to take any special action here.  Mouse events
    >> will be passed to your view automatically.  Are you seeing
    >> something different?
    >
    > What I'm seeing is that when I try to drag the NSSlider it will
    > move the window instead. Is there a way to get around this?

    If you don't want clicks in your view to allow dragging the window,
    you should override -[NSView mouseDownCanMoveWindow] to return NO.
    By default, however, sliders do not allow dragging the window, so you
    should not see a click in a slider move the window unless you've
    overridden hitTest: to intercept clicks.

    I wasn't able to reproduce this in a test app.  If you're still
    seeing this and the above didn't help, please send me an app that
    demonstrates this.  Thanks!

    -Peter
previous month march 2008 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today