Scintilla as a DesktopTextArea Replacement

Today i started my very first experiments with the new MBS Scintilla Plugin. I hope i can use it as a replacement for the DesktopTextArea. We have in my App a Window which is used for Plain Text, Markdown Code and HTML “Code”.
I hope i can make it look, like just any other DesktopTextArea. But i am already struggeling while trying to remove the Line Numbering on the left Side and setting the Font, Font Size and so on.

Is it possible to remove the Line Numbers Margin?

I think i’ve found it here: Scintilla Documentation

Disable Margins:

Me.Margin(0).Width = 0
Me.Margin(1).Width = 0

Activate Word Wrap:

Me.WrapMode = DesktopScintillaControlMBS.kWrapWord
1 Like

See also articles we wrote over time:

1 Like

Since you and the project site have extensive documentation, I’m making good progress. All I’m missing now is a really simple description of how I can create my very own style definition. :blush:

Let’s assume that I want Scintilla to behave like a simple TextArea that marks entire words enclosed in < and > in red and bold. However, everything else in Scintilla should be displayed 1:1 as plain text. Are there a few instructions with which I could define this, for example in the Open Event?

Either you pick one of the existing schemes like the one for XML and customize it.
Or you define your own custom styling with the StyleNeeded event.

1 Like

Thank you @Christian_Schmitz

I’m always a bit short on time, but I’ll take a closer look at it shortly.
In any case, you have given us a very exciting control with Scintilla. :+1:

2 Likes

A shameless plug for my open source text editor which is 100% Xojo code:

https://garrypettet.com/projects/syntaxarea.html

5 Likes

Until I find the time to write something sophisticated and secure, I’ll use a modified version of one of your StyleNeeded examples for my tests:

#Pragma BackgroundTasks False

Dim startPos As Integer = Me.EndStyled
Dim lineNumber As Integer = Me.LineFromPosition(startPos)
Dim LineStartPos As Integer = Me.PositionFromLine(lineNumber)

Dim t As String = Me.Text
Dim pos As Integer = LineStartPos

Dim doStyle As Boolean = False

While pos < position
  
  Var ch As String = t.Middle(pos, 1)
  
  If ch = "<" Then doStyle = True
  If doStyle Then Me.SetStyling(pos, 1, Me.Style(2))
  If ch = ">" Then doStyle = False
  
  pos = pos + 1
  
Wend
1 Like

Hello @Christian_Schmitz. Is there something like a VerticalScrollPosition (like in the Xojo TextArea) function in the Scintilla plugin? Can’t find anything like that. Thank you.

Please see the FirstVisibleLine property

1 Like