Line Wrap for Textarea in Xojo Mac applications

Sub SetLineWrap(TextView as NSTextViewMBS, isWrap as Boolean)
dim cLargeNum as Double = 10000000
dim myScrollView as NSScrollViewMBS = TextView.enclosingScrollView
dim myTextContainer as NSTextContainerMBS = TextView.textContainer
if not isWrap then
myScrollView.hasHorizontalScroller = True
myScrollView.autoresizingMask = TextView.NSViewHeightSizable+TextView.NSViewWidthSizable
myTextContainer.containerSize = NSMakeSizeMBS(cLargeNum, cLargeNum)
myTextContainer.widthTracksTextView = false
TextView.setMaxSize(cLargeNum, cLargeNum)
TextView.isHorizontallyResizable = True
TextView.autoresizingMask = TextView.NSViewNotSizable
else
myScrollView.hasHorizontalScroller = False
myScrollView.autoresizingMask = 0
myTextContainer.containerSize = NSMakeSizeMBS(myTextContainer.containerSize.Width, cLargeNum)
myTextContainer.widthTracksTextView = True
TextView.setMaxSize(TextView.visibleRect.Width, cLargeNum)
TextView.isHorizontallyResizable = false
TextView.autoresizingMask = TextView.NSViewHeightSizable+TextView.NSViewWidthSizable
end if
TextView.needsDisplay = True
End Sub
As you see the main difference between both modes is whether the text content view resizes with the the textarea control. Normally it does, but to disable line wrap, we disable that and allow it to size to a huge size horizontally.
