Showing a popover from an NSOutlineView

  • Rather than try to get an NSPopUpMenu to work by displaying a window instead of the menu, I'm going down the path of using an NSPopover instead. It allows multiple events in the window and can dismiss when the user clicks somewhere else. Great. Now I *also* need to display this popover from a cell in an outline view. Previously, the cell that used to display this window was a subclass of NSPopUpButtonCell. The cell needs to *look* like a popup cell with the name on the left and popup triangle on the right. I get the feeling that I should not keep using an NSPopUpButtonCell for this, because it will run into the same issues that I was trying to work around before. So is it possible to use some other NSCell class and embed an NSPopUpButtonCell inside of it just so it can do the drawing, but allow me to handle the mouse tracking so I can show the popover instead? Or is there another way to draw a popup triangle? It doesn't look like an outline view cell can be an NSButtonCell.

    Any guidance would be appreciated, as this entire window is overly complex and I'm about to go insane.

    --
    Steve Mills
    office: 952-818-3871
    home: 952-401-6255
    cell: 612-803-6157
  • I've got a simple case for iOS that I can send you where I issue an UIPopoverController and a PopoverContentViewController from a UIButton in a UINavigationBar.

    Sounds like you're trying to do this in the Mac, but if you think it will help, I'll strip the project down to the minimum and send your way.  Will work on iOS 5 and up, Xcode 4.2 and up.

    As for retheme-ing the border for the popover, haven't tried that yet.  If you need some close to accurate triangles, I can get those for you and you can put them in a UIImageView over the button.

    Let me know.

    On May 22, 2013, at 5:03 PM, Steve Mills wrote:

    > Rather than try to get an NSPopUpMenu to work by displaying a window instead of the menu, I'm going down the path of using an NSPopover instead. It allows multiple events in the window and can dismiss when the user clicks somewhere else. Great. Now I *also* need to display this popover from a cell in an outline view. Previously, the cell that used to display this window was a subclass of NSPopUpButtonCell. The cell needs to *look* like a popup cell with the name on the left and popup triangle on the right. I get the feeling that I should not keep using an NSPopUpButtonCell for this, because it will run into the same issues that I was trying to work around before. So is it possible to use some other NSCell class and embed an NSPopUpButtonCell inside of it just so it can do the drawing, but allow me to handle the mouse tracking so I can show the popover instead? Or is there another way to draw a popup triangle? It doesn't look like an outline view cell can be an NSButtonCell.
    >
    > Any guidance would be appreciated, as this entire window is overly complex and I'm about to go insane.
    >
    > --
    > Steve Mills
    > office: 952-818-3871
    > home: 952-401-6255
    > cell: 612-803-6157
  • On May 22, 2013, at 16:15:31, Alex Zavatone <zav...>
    wrote:

    > I've got a simple case for iOS that I can send you where I issue an UIPopoverController and a PopoverContentViewController from a UIButton in a UINavigationBar.
    >
    > Sounds like you're trying to do this in the Mac, but if you think it will help, I'll strip the project down to the minimum and send your way.  Will work on iOS 5 and up, Xcode 4.2 and up.

    Yes, OS X, not iOS. If your case doesn't involve an outline view or table view, I don't think it will be of much help. I already have code to show a popover from a button. I'm asking about showing a popover from a call in an outline view.

    > As for retheme-ing the border for the popover, haven't tried that yet.  If you need some close to accurate triangles, I can get those for you and you can put them in a UIImageView over the button.

    I'm not retheming the popover. I asked about drawing a popup triangle.

    --
    Steve Mills
    office: 952-818-3871
    home: 952-401-6255
    cell: 612-803-6157
  • Have you considered subclassing NSPopupButtonCell and overriding the interaction code?  The alternative would be to subclass NSCell (or an appropriate subclass) and override the drawing methods.  For the triangle, you could either use an image, or preferably, measure the dimensions and draw it using a CGPath.

    You may also want to consider a view-based outline view, as it is a bit easier to work with, and will be easier to show a popover from.

    Finally, from an interaction design perspective, you may want your cell/view to look a bit different than a NSPopupButtonCell, as things which behave differently should look different.

    Thanks,
    Jon

    On May 22, 2013, at 2:19 PM, Steve Mills <smills...> wrote:

    > On May 22, 2013, at 16:15:31, Alex Zavatone <zav...>
    > wrote:
    >
    >> I've got a simple case for iOS that I can send you where I issue an UIPopoverController and a PopoverContentViewController from a UIButton in a UINavigationBar.
    >>
    >> Sounds like you're trying to do this in the Mac, but if you think it will help, I'll strip the project down to the minimum and send your way.  Will work on iOS 5 and up, Xcode 4.2 and up.
    >
    > Yes, OS X, not iOS. If your case doesn't involve an outline view or table view, I don't think it will be of much help. I already have code to show a popover from a button. I'm asking about showing a popover from a call in an outline view.
    >
    >> As for retheme-ing the border for the popover, haven't tried that yet.  If you need some close to accurate triangles, I can get those for you and you can put them in a UIImageView over the button.
    >
    > I'm not retheming the popover. I asked about drawing a popup triangle.
    >
    > --
    > Steve Mills
    > office: 952-818-3871
    > home: 952-401-6255
    > cell: 612-803-6157
    >
  • Yeah, if you need the triangle, I can toss you an Illustrator file or a PNG so that you can just add a UIImage to the button.

    On May 22, 2013, at 5:19 PM, Steve Mills wrote:

    > On May 22, 2013, at 16:15:31, Alex Zavatone <zav...>
    > wrote:
    >
    >> I've got a simple case for iOS that I can send you where I issue an UIPopoverController and a PopoverContentViewController from a UIButton in a UINavigationBar.
    >>
    >> Sounds like you're trying to do this in the Mac, but if you think it will help, I'll strip the project down to the minimum and send your way.  Will work on iOS 5 and up, Xcode 4.2 and up.
    >
    > Yes, OS X, not iOS. If your case doesn't involve an outline view or table view, I don't think it will be of much help. I already have code to show a popover from a button. I'm asking about showing a popover from a call in an outline view.
    >
    >> As for retheme-ing the border for the popover, haven't tried that yet.  If you need some close to accurate triangles, I can get those for you and you can put them in a UIImageView over the button.
    >
    > I'm not retheming the popover. I asked about drawing a popup triangle.
    >
    > --
    > Steve Mills
    > office: 952-818-3871
    > home: 952-401-6255
    > cell: 612-803-6157
    >
    >
previous month may 2013 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