I can't seem to be able to edit a NSTextView
in my custom NSPanel I am creating.
- (id) initWithPoint:(CGPoint)point andAnnotation:(PDFAnnotationText*)annotation {
if (!(self = [super init]))
return self;
if (self.annotationPanelWindow == NULL)
[NSBundle loadNibNamed: @"IBNoteAnnotationEditPanel" owner:self];
selectedAnnotation = annotation;
CGRect frame = self.annotationPanelWindow.frame;
frame.origin = point;
[self.annotationPanelWindow setFrame:frame display:YES animate:NO];
[self.annotationPanelView setHidden:NO];
[self.annotationPanelWindow orderFront:self];
//[self makeFirstResponder:self.textView];
[self.textView setString:annotation.contents];
return self;
}
The view is not clickable nor editable. Instead you seem to be able to interact with the view behind my custom panel when clicking on the textview. Other buttons and views inside this custom panel works as expected however.
This is the header file:
@property (strong) IBOutlet NSPanel *annotationPanelWindow;
@property (strong) IBOutlet NSView *annotationPanelView;
@property (strong) IBOutlet NSTextView *textView;
- (id) initWithPoint:(CGPoint)point andAnnotation:(PDFAnnotationText*)annotation;
This is the code I use to create/open the panel:
-(void)showNoteAnnotationEditPanel
{
CGPoint point = _activeAnnotation.bounds.origin;
point = [self convertPoint:point fromPage:_activeAnnotation.page];
point = [self convertPoint:point toView:nil];
self.noteAnnotationEditPanel = [[IBNoteAnnotationEditPanel alloc] initWithPoint:point andAnnotation:(PDFAnnotationText*)_activeAnnotation];
}