On 25.05.2013 09:16, Germán Arias wrote:
Is there a way to know the localization (x, y) of the I-beam in a textview?
Internally we use _insertionPointRect but this isn't accessible from
outside the NSTextView. The best you can do is to duplicate the code in
the method -updateInsertionPointStateAndRestartTimer: to compute that
rectangle yourself. I think this is the important code snipplet:
new = [_layoutManager
insertionPointRectForCharacterIndex:
_layoutManager->_selected_range.location
inTextContainer: _textContainer];
new.origin.x += _textContainerOrigin.x;
new.origin.y += _textContainerOrigin.y;
/* If the insertion would extend outside the view (e.g. because it's
just to the right of a character on the far right edge of the view,
a common case for right-aligned text), we force it back in. */
if (NSMaxX(new) > NSMaxX(_bounds))
{
new.origin.x = NSMaxX(_bounds) - new.size.width;
}
All the instance variables used here are available from the outside as well.
Hope this helps
Fred
_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev