TextArea Margin

When populating a TextArea with several paragraphs of text from a database, the text runs from the very left edge of the TeaxtArea to the very right edge of the TeaxtArea. Is there a way to have a margin on the left, right, top and bottom?

This is what it looks like currently:
textarea1

This is what I would like it to look like:
textarea2

Thanks

Hide the TextArea rectangle, ScrollBars, draw a rectangle with the desired margn around it and place ScrollBars inside.

See the idea ?

1 Like

if it is only a viewer/reader

i think this textarea did not have your feature.
if you have a fix length of chars you could add spaces

Sub Action() Handles Action
  Var t As String = EndOfLine.CR + TextArea1.Text + EndOfLine.CR
  
  Var rows() As String = t.Split(EndOfLine.CR)
  
  TextArea1.Text = String.FromArray(rows,"  "+EndOfLine.CR+"  ")
End Sub

or use a htmlviewer
or use a canvas and paint text into with textshape and extern scrollbar

It looks much better with some space (second image), maybe you can create a Feature Request using the Feedback.

@Emile_Schwarz I see the idea however, I’ll have to do some more reading because, since I just started testing out xojo a week ago, I don’t yet know how to hide the TextArea or how to draw a rectangle and place the text into it.

@MarkusR It does not have a fixed length of characters.

@AlbertoD The second image is from the app that I did in Purebasic. It would be a nice feature for xojo.

Thanks guys.

Is CustomEditField (GitHub - tempelmann/custom-editfield: Powerful text editor class made in Xojo.) only for macOS or also for Windows?

John:

the Language reference is your best friend.

TextArea entry:
https://documentation.xojo.com/api/deprecated/textarea.html

Check HasBorder to remove the TextArea recangle.

To draw on a window, check g As Graphics (for example, add a Paint Event to the window and place code to draw there).

I do not talked abut Hide the TextArea, but remove the border; this was what I had in mind.

Welcome !

@Emile_Schwarz I created a rectangle with a sunken appearance and the placed a TextArea inside the Rectangle. I set the TextArea size to be slightly smaller than the rectangle. It accomplishes the apprearance of margins except on the right side where it is up against the scrollbar. I’m not sure how to get around this.

Here is what it looks like.

textarea1

Mac? Windows? Linux?

We may be able to add some margin properties for the TextArea control via plugin.

2 Likes

at least it looks much better than before.
for reading a brighter background color would be better.

It is not a secret that the TextArea sucks in Xojo. If you are working on windows Only, I posted a work around a while ago: Why is RTF support so AWFUL? (and some work arounds)

@Christian_Schmitz I am using Windows 7, I do not like Windows 10.

@MarkusR I lightened it up a little:

textarea1

@Ivan_Tellez Thanks, I’ll take a peek at it.

In Design mode, set the Vertical ScrollBar to OFF.
Add a ScrollBar from the Tools at the correct location.

You’re done (excepted you have to add code to deal with your ScrollBar Control).

I was short of words in my first answer, but the idea was already there.

his idea would using the .VerticalScrollPosition and .LineNumber with a extra scrollbar.

I tested the rtf idea and it failed.

I used 2880 twips for both (default) margins and the document was loaded without any margin set (with a Xojo preset default value).