Scintilla progress

Let’s report on a bit of progress for upcoming pr3:

I got the lexer started for xojo and it can do the comments with double slash:


And also we now have built-in library, so no longer DLL loading for:

  • MacOS 64-bit Intel and Apple Silicon
  • Windows 32/64bit with Intel and ARM.

Linux builds, but not yet sure how to do the GTK based control in Xojo.

1 Like

Your only way in Gtk is to return the handle in the Xojo handle getter. You cannot embed it on the panel you get normally. So returning handle to the Gtk control is your friend. If the Schintilla does not come in one part then you need to make one of the Box containers around it and then return the handle to that.

1 Like

Is there any possibility of writing a custom order, even if I’d have to write C++? My intended use case is for ini files, which I believe there is already a lexer for, but game I support uses some non-standard syntax.

It’s not a big deal, as users have been perfectly fine with Notepad++’s syntax coloring. But I’d at least try to do it better, if possible.

You can still use no lexer and fill in StyleNeeded event to colorize when needed.

New screenshot:

This is on Windows with new corrections for HiDPI stuff.
Also it shows bookmarks, which I added for the example to set by clicking on the new margin between folders and line numbers.


I’ve started playing around with this. A few things I’ve noticed. My insertion point cursor will not blink and I cannot figure out why. There’s no insertion point at all, which makes it really awkward to type in. The example does have a blinking insertion point, and I’ve copied all the code in the XojoExample method, yet it won’t blink.

I’m having trouble figuring out which lexar I should use with a .ini file. Notepad++ has “MS ini file” that works pretty well, but I don’t see a match in lexilla/lexers at master · ScintillaOrg/lexilla · GitHub which is confusing. Looking at the Notepad++ code, I see they use “ini” as the input for the lexer initialization. I suspect they have a custom lexer for this format, but I haven’t been able to confirm it. I’ve tried using Me.InitializeLexer("ini") but I don’t think it’s working. Some sort of error, such as an exception, would be nice if I give it a value it doesn’t recognize.

The ini lexer seems to be named “Properties”.

Like this:

c.InitializeLexer "props" // Windows ini files

We may need to get a list of levers and their name.

Yeah. Something in the docs would be good. The props lexer does seem to work pretty well for the ini file. I’ve been looking over the Scintilla docs trying to figure out autocomplete. Doesn’t seem to hard.

The only thing that still stumping me is the insertion point. I haven’t tested yet, but I suspect it is missing because I have it placed on a container control.

And lastly, as we discussed before, the ability to hide the status bar would be wonderful. I don’t see that option in Scintilla’s docs though, but I could just be missing it.

For pr3, we’ll have a ShowInfoBar property, which you can set to false in the IDE.
The insertion point shows for me.

For auto complete, well, we may need to have an example in the next weeks.

Yeah it does for me in your example, but not using your same code in my project. I’m still working on narrowing it down for you because something is going on.

New version is uploaded: MBS Xojo Plugins, version 21.6pr3

1 Like

Awesome. Here’s my notes:

  • Having ReadOnly = True prevents updating the Text property programmatically. This is easily worked around by turning off ReadOnly before assigning to Text, but it’s definitely unexpected.
  • ShowInfoBar is design-time only. If that’s intentional, the property should be marked as such so that attempting to assign a value to it will throw a compile error. If it’s not intentional, then it’s just a bug.
  • Failing to include the 3 tiff images in the app’s resources folder on Mac causes a crash while creating the control. I really hope these images will be optional, because I just don’t need them.
  • I still can’t figure out the insertion point issue. No matter how I use it in my project, there’s no insertion point. Yet no matter how I change the example project, it won’t go away. I’ve tried both x86 and ARM on Mac, I’ve tried putting the control in a container, I’ve tried using a subclass of ScintillaControlMBS, and I’ve tried the control with and without the setup code. It makes no sense to me. So the best I can do is point you to GitHub - thommcgrath/Beacon at scintilla-editor. Click “New Project” and choose “Custom Config” on the left. There is a lot of work I haven’t done yet, but that doesn’t seem to be necessary to get the insertion point working, as a fresh/empty ScintillaControlMBS shows it just fine in a sample project.
  • This has to be simple, but I can’t figure out the vertical scroll position property. I see XOffset which seems to be the horizontal scroll position, but I don’t see Offset or YOffset.
  • The line number gutter still has issues redrawing when scrolling back up.
1 Like

I can fix that one. And we may document it, that read only means read only.
So you would get ModifyAttemptReadOnly event, there you can google to readonly = false and allow the edit.

I don’t think there is a flag for this.
But I can maybe change it, so you can enable it in code. But I don’t think I can just remove it easily.

I can check. But it seems the control on macOS needs the cursor pictures.

See FirstVisibleLine property for vertical position.

Do you see it in our example or in your project?

The example shows it too. In the other thread, Garry had reported it with a screenshot.

Looks like I can patch the line to avoid it. But you will miss the special cursor.

That’s ok. In my case, I don’t use the info bar, bookmarks, or folders. I think even if I did, the large backwards cursor is just odd.

I get it to blink for me on macOS:

Bildschirmfoto 2021-12-15 um 18.53.28

Could it be that we get the caret working, when you move to other app and then back?

I fixed a focus problem, but for some unknown reason, the focus is not set on the control.