txt := TCocoaTextView.alloc.initwithframe(nr); txt.setAllowsUndo(true); // setting up a default system font (to be consistent with other widgetsets) txt.setFont( NSFont.systemFontOfSize( NSFont.systemFontSizeForControlSize(NSRegularControlSize) )); txt.setRichText(false); txt.setImportsGraphics(false); txt.setUsesRuler(false);
// this is necessary for Ward Wrap disabled, so NSViewText // doesn't have a constraint to resize // Apple default maxsize is InitialWidth, 10000000 // (MaxSize is also changed automatically, if NSViewText size is changed) txt.setMaxSize(NSMakeSize(10000000, 10000000)); scr.setDocumentView(txt);
// ToDo: This should be made selectable in the LCL txt.setAutomaticQuoteSubstitutionEnabled(False); txt.setAutomaticLinkDetectionEnabled(False); // macOS 10.6 version if txt.respondsToSelector(objcselector('setAutomaticDataDetectionEnabled:')) then txt.setAutomaticDataDetectionEnabled(false); if txt.respondsToSelector(objcselector('setAutomaticTextReplacementEnabled:')) then txt.setAutomaticTextReplacementEnabled(False); if txt.respondsToSelector(ObjCSelector('setAutomaticDashSubstitutionEnabled:')) then txt.setAutomaticDashSubstitutionEnabled(False); if txt.respondsToSelector(ObjCSelector('setAutomaticSpellingCorrectionEnabled:')) then txt.setAutomaticSpellingCorrectionEnabled(False);
// defaulting to System colors // This makes NSTextView to be responsive to theme color change (Mojave 10.14) txt.setTextColor(NSColor.textColor); txt.setBackgroundColor(NSColor.textBackgroundColor); scr.setFocusRingType(NSFocusRingTypeExterior);