0

I have the following code where I create a textLabel. Although I have [textView setEditable:YES]; in this chunck of code, I still can't edit the text inside the textbox while my app is running. What am I doing wrong here?

-(NSView *)elementView {
NSView* view  = [super elementView];
NSTextField* textView = [[[NSTextField alloc] initWithFrame:view.bounds] autorelease];

textView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
textView.stringValue = self.text != nil ? self.text : @"Label";
textView.textColor = self.textColor;
textView.font = [NSFont fontWithName:self.fontName size:self.fontSize];

NSTextAlignment alignment = NSLeftTextAlignment;
if([@"center" isEqualToString:self.textAlignment]) {
    alignment = NSCenterTextAlignment;
} else if([@"right" isEqualToString:self.textAlignment]) {
    alignment = NSRightTextAlignment;
}
textView.alignment = alignment;

[textView setEditable:YES];
[textView setSelectable:NO];
[textView setDrawsBackground:NO];
[textView setContinuous:NO];
[view addSubview:textView];
return view;

any help would be appreciated.

Elendas
  • 733
  • 3
  • 8
  • 22

1 Answers1

1

The documentation for NSTextView says:

If a text view is made not selectable, it’s also made not editable, and buttons on the Find panel are dimmed. Text views are by default both editable and selectable.

So I guess you have to not set selectable to NO.

Thilo
  • 257,207
  • 101
  • 511
  • 656
  • It does react different now, but I still can't edit them. anyway, there's a blue border if I click on the textbox now – Elendas Oct 19 '12 at 08:20