Re: Position of I-beam cursor
Germán Arias wrote: Thanks. I want implement autocomplete for textview. So I need know where to display the window with autocomplete suggestions. I don't understand why you need to know the position of the mouse cursor for that. I think you should present the window at the place where the completed text appears. Wolfgang ___ Gnustep-dev mailing list Gnustep-dev@gnu.org https://lists.gnu.org/mailman/listinfo/gnustep-dev
Re: Position of I-beam cursor
On 2013-05-26 03:49:15 -0600 Wolfgang Lux wolfgang@gmail.com wrote: Germán Arias wrote: Thanks. I want implement autocomplete for textview. So I need know where to display the window with autocomplete suggestions. I don't understand why you need to know the position of the mouse cursor for that. I think you should present the window at the place where the completed text appears. Wolfgang Not the mouse cursor, is the i-beam cursor. I don't have a Mac to see how this works under Cocoa. But, for example, in this image: http://www.creativetechs.com/iq/tip_images/OSX-Autocomplete.png I imagine the window appears under the word you are typing. So, I need know where is typing the user. Germán. ___ Gnustep-dev mailing list Gnustep-dev@gnu.org https://lists.gnu.org/mailman/listinfo/gnustep-dev
Re: Position of I-beam cursor
Hi Germán, Not the mouse cursor, is the i-beam cursor. I don't have a Mac to see how this works under Cocoa. But, for example, in this image: http://www.creativetechs.com/iq/tip_images/OSX-Autocomplete.png I imagine the window appears under the word you are typing. So, I need know where is typing the user. Germán. Sounds like a cool project! The I beam is called the insertion point in NSTextView. You can get the character index of it using [self selectedRange] inside NSTextView. The I-beam is only present if length == 0 and location != NSNotFound. To get the (x,y) coordinates for positioning the popup window, you can use -firstRectForCharacterRange:. (NSTextInput protocol). Note that apple's docs say this returns a result in screen coordinates, but our NSTextView's implementation doesn't seem to do that. Eric ___ Gnustep-dev mailing list Gnustep-dev@gnu.org https://lists.gnu.org/mailman/listinfo/gnustep-dev
Re: Position of I-beam cursor
On 26 May 2013, at 02:32, Germán Arias ger...@xelalug.org wrote: Thanks. I want implement autocomplete for textview. So I need know where to display the window with autocomplete suggestions. I'm adding the code in NSTextView.m, not in NSTextView_actions.m. I think this is the correct place, right? Thanks! SourceCodeKit can provide autocompletions, but there's no way of connecting them up to the GUI at the moment. It would be great to have this working nicely. David ___ Gnustep-dev mailing list Gnustep-dev@gnu.org https://lists.gnu.org/mailman/listinfo/gnustep-dev