Re: NSMenu Trouble
Re: NSMenu Trouble
- Subject: Re: NSMenu Trouble
- From: J Nozzi <email@hidden>
- Date: Sat, 13 Dec 2003 18:47:58 -0500
Okay, I have a workable solution. Rather than try to fire the menu
event directly, I decided to try sending the keyboard event for
"cmd-b". Below is the code, from the ApplicationServices.framework.
// Send Cmd-B Event
CGPostKeyboardEvent( (CGCharCode)0, (CGKeyCode)55, true );
CGPostKeyboardEvent( (CGCharCode)'B', (CGKeyCode)11, true );
CGPostKeyboardEvent( (CGCharCode)'B', (CGKeyCode)11, false );
CGPostKeyboardEvent( (CGCharCode)0, (CGKeyCode)55, false );
This works beautifully. iBlog does the same thing I'm attempting to
do and I noticed that if you click the toolbar button for 'bold' or
other attributes, it fired the font menu (it flashes). I knew this
could be done, but I suspect the author probably took this route. In
hindsight, it seems the easiest.
By the way, I had to search out the keycodes and found this page to
be of help:
http://developer.apple.com/documentation/mac/Text/Text-571.html#MARKER
-9-1
Hopefully, this will help someone else.
- J
On Dec 13, 2003, at 5:19 PM, Andreas Mayer wrote:
Am 13.12.2003 um 22:35 schrieb Izon de Bartas:
I was attempting to fire the menu item since it seems to mysteriously
handle this itself (even though its tag and other information remains
the same). I'm THOROUGHLY confused by this.
_______________________________________________
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.