• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Custom field editor context menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom field editor context menu


  • Subject: Custom field editor context menu
  • From: "Rimas M." <email@hidden>
  • Date: Mon, 7 Jun 2010 23:28:27 +0300

Hello list,

Congrats on WWDC week. Have great sessions :)

I have some troubles implementing custom context menu in NSTextField.
While field is editing, field editor take control over field. So I
implemented my custom field editor:

- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client
{
	if (sender && client are OK)
	{
		static MyCustomFieldEditorView *_editor = nil;

		if (_editor == nil)
		{
			_editor = [[MyCustomFieldEditorView alloc]
initWithFrame:[(NSTextField*)client frame]];
		}

		[_editor setMenu:[(NSTextField*)client menu]];
		return _editor;
	}
	return nil;
}

Field editor is replaced with my own one, my menu is displayed. Great.
But that works if there is no selected text in editor. But if any, I
am getting:

Spelling suggestion 1
Spelling suggestion 2
...
Spelling suggestion N
-----
Ignore Spelling
Learn Spelling
-----
Search in Spotlight
Search in Google
-----
Look up in Dictionary
-----
My Custom menu item 1
...
My Custom menu item N

I want menu to have only my custom items. No spelling & co above my
items. Always. Even with some text selected.

How could I achieve that?

Any help is very appreciate.

Regards,

Rimas M.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Custom field editor context menu
      • From: Martin Wierschin <email@hidden>
  • Prev by Date: Re: Notification of window visible?
  • Next by Date: Limitation on an NSStatusBarItem's menu?
  • Previous by thread: Re: Problem with setting a cursor
  • Next by thread: Re: Custom field editor context menu
  • Index(es):
    • Date
    • Thread