[SOLVED] popup menus at a specified position
[SOLVED] popup menus at a specified position
- Subject: [SOLVED] popup menus at a specified position
- From: Cristian Savu <email@hidden>
- Date: Mon, 11 Nov 2002 09:25:21 +0200
Hy there,
There were several threads talking about displaying menus wherever
somebody wants.
Cocoa doesn't provide us a direct solution, but there is an easy
workaround (it took me a while to figure out about this:( ).
This could be also a solution for context menus.
// create a fake event (NSLeftMouseDown) to send it as a base
for pop-up menu.
NSEvent *theEvent= [NSEvent
mouseEventWithType:NSLeftMouseDown
location:NSMakePoint(200,200)
modifierFlags:0
timestamp:1
windowNumber:[[NSApp mainWindow] windowNumber]
context:[NSGraphicsContext currentContext]
eventNumber:1
clickCount:1
pressure:0.0];
//and now pop the menu
[NSMenu popUpContextMenu: [NSApp mainMenu] withEvent:theEvent
forView: aView];
Good luck !
Cristian
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.