Q: How do I disable and enable an NSTextView?A: Currently there is no direct way to disable and re-enable an NSTextView. However, with a few lines of code you can implement this feature on your own. The sample code below best illustrates this by changing the selectable and editable attributes as well as its text color. Listing 1: Disabling and Enabling NSTextView
-(void)enableTextView:(BOOL)enableIt
{
[textView setSelectable: enableIt];
[textView setEditable: enableIt];
if (enableIt)
[textView setTextColor: [NSColor controlTextColor]];
else
[textView setTextColor: [NSColor disabledControlTextColor]];
}
Document Revision HistoryDate | Notes |
---|
2006-09-11 | First Version |
Posted: 2006-09-11
|