FROM : j o a r
DATE : Thu Dec 05 22:25:01 2002
What if you simply check the location & state of the selection vs. the
location of the mouse in the view when "menuForEvent:" is called, and
extend the selection manually if needed. Doesn't that work?
Another possible solution might be to hook into "validateMenuItem:"
(see: NSMenuValidation) that is called before the menu pops up.
j o a r
On Friday, Dec 6, 2002, at 02:34 Europe/Stockholm, jon klein wrote:
> I'm overriding an NSTextView in order to provide a customized
> contextual menu based on the currently selected text. If I
> select a word, and then option-click, it works great.
>
> The problem is that when I option-click on an unselected word
> in order to simultaneously select the word and bring up the
> contextual menu, menuForEvent: gets called before the text
> is selected, and thus it shows the contextual menu for the
> old selection.
>
> Does anybody know how to solve this problem? OmniWeb handles
> its contextual menus correctly in this respect, so there must
> be a way...
DATE : Thu Dec 05 22:25:01 2002
What if you simply check the location & state of the selection vs. the
location of the mouse in the view when "menuForEvent:" is called, and
extend the selection manually if needed. Doesn't that work?
Another possible solution might be to hook into "validateMenuItem:"
(see: NSMenuValidation) that is called before the menu pops up.
j o a r
On Friday, Dec 6, 2002, at 02:34 Europe/Stockholm, jon klein wrote:
> I'm overriding an NSTextView in order to provide a customized
> contextual menu based on the currently selected text. If I
> select a word, and then option-click, it works great.
>
> The problem is that when I option-click on an unselected word
> in order to simultaneously select the word and bring up the
> contextual menu, menuForEvent: gets called before the text
> is selected, and thus it shows the contextual menu for the
> old selection.
>
> Does anybody know how to solve this problem? OmniWeb handles
> its contextual menus correctly in this respect, so there must
> be a way...
| Related mails | Author | Date |
|---|---|---|
| jon klein | Dec 5, 17:35 | |
| j o a r | Dec 5, 22:25 |






Cocoa mail archive

