PDA

View Full Version : opening menu by clicking NSImageView




xmax
Aug 19, 2009, 07:39 AM
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



MrFusion
Aug 19, 2009, 08:17 AM
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

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.

xmax
Aug 19, 2009, 09:30 AM
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

MrFusion
Aug 19, 2009, 09:47 AM
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

The documentation is your friend:
Application Menu and Pop-up List Programming Topics for Cocoa