텍스트보기로 지적하고 window
창을 가리키는 변수 변수입니다 :
// -firstRectForCharacterRange:actualRange returns a frame rectangle
// containing the insertion point or, in case there's a selection,
// the first line of that selection. The origin of the frame rectangle is
// in screen coordinates
NSRange range = [textView selectedRange];
NSRect screenRect = [textView firstRectForCharacterRange:range actualRange:NULL];
// -convertRectFromScreen: converts from screen coordinates
// to window coordinates
NSRect windowRect = [window convertRectFromScreen:screenRect];
// The origin is the lower left corner of the frame rectangle
// containing the insertion point
NSPoint insertionPoint = windowRect.origin;
나는 NSTextView에 흥미를 느끼지 않을 것이다. 이 문제를 조사해 주셔서 감사합니다. –
질문이 하나 더 있습니다 : 질문을 C++로 태그했지만 Cocoa는 주로 Objective-C API를 제공합니다. Objective-C (또는 Objective-C++)는 실행 가능한 솔루션입니까 아니면 C++에만 관심이 있습니까? –
문제에 접근하는 방법에 대한 아이디어는 충분할 것입니다. 언어 문제를 해결할 수 있습니다. 다시 한번 감사드립니다. –