« Variable Name Auto Co… | Home | MBS FileMaker Plugin,… »

Adding a Scintilla based control to Xojo

In the last years we saw a lot of need for various edit controls in Xojo. The built-in TextArea is fine for a lot of people, but some need more. A couple of people extended the built-in control with various extensions, but those are always limited by what the platform can do. MacOS is quite good with NSTextView used as implementation and you see a lot of stuff via our NSTextViewMBS class to e.g. insert a picture. On Windows the RichEdit control is a bit limited, but we still got a few TextArea extensions in our plugins:
Next a few people started to write Canvas based control on their own. Like the Formatted Text Control for Xojo, which is now open source and can be used as an editor for styled text. Then recently we got notice of the Better Code Editor (BCE) Control from Garry Pettet. This may also help a few people and have it as source code in their projects and modify it.

But I looked for more and thanks to a little tip from Norman on my visit in September, I got pointed to the Scintilla project. That is am open source C++ library defining an editing component, which we can host in a plugin based Xojo control: ScintillaControlMBS
The description from their website shows what we may get in Xojo:

As well as features found in standard text editing components, Scintilla includes features especially useful when editing and debugging source code. These include support for syntax styling, error indicators, code completion and call tips. The selection margin can contain markers like those used in debuggers to indicate breakpoints and the current line. Styling choices are more open than with many editors, allowing the use of proportional fonts, bold and italics, multiple foreground and background colours and multiple fonts.

We may not get all things right into the control for the first release, but since the control seems to work fine for macOS and Windows already, I am confident we can ship this as a 1.0 with our next plugin release in January. There is still a long todo list, but we like to give interested developers a preview. Please try it in next pre-release.

Things we may do later, if possible include support for Linux. Maybe we can provide the library within the plugin instead of an external library. And we may improve the API to be more Xojo like, add printing functions, marker pictures or async loading.

This control should provide a great editor for XojoScript code in various projects. Also editing other things like SQL statements, JavaScript, JSON or HTML in your project. It has a great performance and should handle huge texts better than all the other choices.

Please try it in the next days and let us know what you think!
06 12 21 - 15:37