• 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
Re: NSTextInputClient Protocol Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextInputClient Protocol Question


  • Subject: Re: NSTextInputClient Protocol Question
  • From: Aki Inoue <email@hidden>
  • Date: Mon, 21 May 2012 19:57:24 -0700

Hello Eric,

> - (NSUInteger) characterIndexForPoint: (NSPoint) iPoint
> - (NSRect) firstRectForCharacterRange: (NSRange) iRange actualRange: (NSRangePointer) oActualRange
> never get called, which I suppose are here for handling mouse events and thus the selection ?

The methods are for the input methods showing various information near your text.  Not for general mouse event handling.

You still need to implement the mouse handling for selection with a custom code for your view.

To handle mouse events in a text input friendly way, you want to first pass all mouse events to -[NSTextInputContext handleEvent:].
If the method returned NO (meaning the text system didn't swallow the event), then, you can perform your custom mouse handling logic for that event.

Aki

On May 21, 2012, at 2:19 AM, Eric Matecki <email@hidden> wrote:

> Hi,
>
> I try to write my own text field, for cross-platform dev. reasons I don't have another choice, unfortunately...
>
> So, in my view, I have this:
>
> @interface MyOpenGLView : NSOpenGLView <NSTextInputClient>
> ...
> @end
>
> @implementation MyOpenGLView
>
> - (void) mouseDown: (NSEvent*) iEvent
> {
>    if( mActiveTextButton )
>    {
>        [[self  inputContext]  handleEvent: iEvent];
>    }
>    else
>    {
> 	// this is the crossplatform stuff...
>        AddMouseEvent( self, iEvent, ::nWindowingSystem::kClass_MouseClick, ::nWindowingSystem::kClick_LeftDown );
>    }
> }
>
> the same goes for : mouseDragged:, mouseMoved:, mouseUp:, keyDown: and keyUp: .
>
> I also implemented all the required methods from the NSTextInputClient protocol.
>
> Now I can type accented characters, like é, by typing 'Option-e' then "e'.
>
> But I can't select anything.
>
> - (NSUInteger) characterIndexForPoint: (NSPoint) iPoint
> - (NSRect) firstRectForCharacterRange: (NSRange) iRange actualRange: (NSRangePointer) oActualRange
> never get called, which I suppose are here for handling mouse events and thus the selection ?
>
> What am I doing wrong ?
>
> Thanks.
>
> --
> http://www.tvpaint.com
> Eric 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


_______________________________________________

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: NSTextInputClient Protocol Question
      • From: Eric Matecki <email@hidden>
References: 
 >NSTextInputClient Protocol Question (From: Eric Matecki <email@hidden>)

  • Prev by Date: Re: Color matching multiple images in one bitmap
  • Next by Date: Bidirectional, Manual Binding in custom control
  • Previous by thread: NSTextInputClient Protocol Question
  • Next by thread: Re: NSTextInputClient Protocol Question
  • Index(es):
    • Date
    • Thread