I created a little procedure to automatically size text areas based on content. It sizes the text area based on wraparound and tab characters, something that the autosize for the code edit region does not do. (Hint to Maple developers)


    AutosizeTextArea:=proc(TextAreaName, {intMinRows::nonnegint:=5, intMinChars::nonnegint:=50, intMaxChars::nonnegint:=140})
        description "Autosizes the TextArea based on content",
                  "1) TextAreaName__The name of the textarea",
                  "Optional Parameters",
                  "intMinRows________Minimum number of visible rows",
                  "intMinChars_______Minimum character width",
                  "intMaxChars_______Maximum character width";
        uses DocumentTools, StringTools;          
        local strLines, intLongestLine, nLines;
        strLines := Split(GetProperty(TextAreaName,'value'),"\n");
        intLongestLine := max('numelems'~(strLines));
        # Count the characters in each line (add 7 extra characters for each tab). Determine the number of lines to display each line due to wraparound, then add all these together
        #   to determine the number of rows to display.
        nLines := add(ceil~(('numelems'~(strLines) + StringTools:-CountCharacterOccurrences~(strLines, "\t")*~7)/~intMaxChars));
        SetProperty(TextAreaName, 'visibleRows', max(nLines, intMinRows), 'refresh' = true);
        SetProperty(TextAreaName, 'visibleCharacterWidth', min(max(intLongestLine, intMinChars),intMaxChars), 'refresh' = true);
    end proc:

Please Wait...