Re: Newbie - Action Button
Re: Newbie - Action Button
- Subject: Re: Newbie - Action Button
- From: Eric Ocean <email@hidden>
- Date: Sat, 9 Oct 2004 12:43:02 -0700
You need to override -mouseDown:, get the coordinates (in screen
coordinates) of the mouse, and then display the menu based on those
coordinates. It's probably 15-20 lines of code at most.
I think another person on cocoa-dev recently discovered the same thing
in the context of normal contextual menus. If you still have problems,
email me and I'll see what I can do. Send code if possible.
Regards,
Eric Ocean
(p.s. cocoa-dev is the right list for those kinds of questions, not the
xcode list).
On Oct 3, 2004, at 1:04 PM, Alan Francis wrote:
Hi,
I'm a reasonably experienced (10+yrs) C/C++/Java programmer but I just
got my first Mac and have started playing with Cocoa and XCode.
Something (random) I'm having a bit of trouble with is trying to
implement the context-sensitive "action" button, a la finder/mail etc.
I kind of expected it to be available in IB palettes since it seems to
be a pretty standard UI feature now, but it isn't there... On closer
inspection it's obviously hand-rolled in all the apps I've seen that
have it, the only thing that's standard is the graphic.
So...assuming I'm hand-rolling my own...
* I have a toggle button created and two graphics 'borrowed' from
another app for the button in it's normal and depressed states.
* I have a context menu created in IB
* I can hook the menu up to the button (using the menu outlet) so
it triggers when I right-click (ctrl-click).
However, I can't work out how to pop a menu up, in a specific place
(ie underneth the button, left-aligned), when I left-click (click?)
the button ?
Can anyone point me at some sample code ?
Thanks in advance,
Alan.
--
Alan C Francis
http://www.twelve71.com/
http://www.thoughtworks.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden