opening menu by clicking NSImageView

Discussion in 'Mac Programming' started by xmax, Aug 19, 2009.

  1. xmax macrumors member

    Joined:
    Jul 3, 2008
    #1
    Hello,

    I need to open NSMenu when user Left click the mouse under NSImageView.

    Can any one tell me how it is possible ?

    Here I have attached Snapshot that shows opening Menu when user click on NSTextField (label).
    I need to implement like it, but instead of NSTextField I need NSImageView.


    I tired adding NSPopUpButton on NSImageView, but it is not the way I need.


    Thanks,

    xmax
     

    Attached Files:

  2. MrFusion macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #2
    You have to look at mouse actions such as mouseDown. When the mouse is clicked, you get the location from NSEvent and you show a menu at that position. At least, that is how would I go about it, but I haven't tried it.
     
  3. xmax thread starter macrumors member

    Joined:
    Jul 3, 2008
    #3
    Thanks for your reply,
    I am trying to do it, but Let say I got the mouse event and Now I need to open Menu.
    Can you tell me how would I be able to open Menu once I get Mouse within the image Area ?


    Thanks,

    Xmax
     
  4. MrFusion macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #4
    The documentation is your friend:
    Application Menu and Pop-up List Programming Topics for Cocoa
     

Share This Page