Scintilla progress

If your not returning Handle then possibly its the famous first control on window focus bug ? (the 7 year old drama bug)

I fear it may be something like this.

Scintilla separated the code base for Syntax Highlighters and its core text editor. The lexer is now a separate library. (Which I think is a good direction).

As far as I played with the MBS’s plugin I haven’t found a way to reach into the backend. I was really hopping for the plugin to expose the scintilla engine, else it just fills like another text control it missed its potential.

What would you like to reach?
What is missing?
We expose already over 1000 things in documentation.

I added new function to have two controls use same backend and work on same text In two windows.

1 Like

Small video here:

2 Likes

Is there any workaround for the focus issue? Nothing I’ve tried gets the control the focus besides switching to another app first, which obviously isn’t a viable workaround. I’ve tried SetFocus in various places, also setting Window.Focus = Nil first so maybe it’d move the focus away and then back again. I see the focus events trigger, but it doesn’t actually get the focus. Even putting another control on the container with first tab priority doesn’t seem to help.

I thought I got this improved/fixed.
Is it still with plugin control on a container?
Timer with SetFocus after a few milliseconds didn’t do it?

Sorry, I haven’t had time to spend with it. I didn’t think to try a timer. But yes, it’s the same code as before.

Sorry to report there’s no change with the timer. Even with a period as long as 1000, no change. In the action event, I tried both Self.Focus = Self.ConfigArea and Self.ConfigArea.SetFocus, as well as adding Self.Focus = Nil in front to try to shift the focus away. I also tried setting the focus to nil when the timer starts counting, then focusing on the control in the timer action. The only change I noticed is that setting the focus seems to have no effect. What I mean is that if I do not nil the focus first, pressing keys on the keyboard goes to the control. If it nil focus first, even after the timer has fired, keystrokes do not go to control. I get beeps instead. So it seems like neither method of assigning focus to the control is actually doing anything.

With some debug messages, I get the following sequence of events:

12:00:52 PM : Setting focus to nil and starting timer…
12:00:53 PM : Timer Triggered
              FocusReceived

If I navigate away from the app, I get

12:01:03 PM : FocusLost
              FocusOut

Back to the app:

12:01:07 PM : FocusOut
              FocusReceived

And then click the control, which “solves” the problem and actually gives it focus:

12:01:10 PM : FocusIn

That’s the first time FocusIn seems to fire. So there’s definitely something odd going on. What’s the difference between FocusReceived and FocusIn?

FocusReceived is the Xojo event. The plugin usually tells Scintilla control to take the focus then.
And FocusIn is when the editor got focus.

And we shipped:
MonkeyBread Software Releases the MBS Xojo Plugins in version 22.0

and just after that I tried to make a video and discovered a few issues:

  • The example project has wrong MenuAction event. Just delete it.
  • The example uses SQL_Operator constant instead of MySQL_Operator constant.
  • I had to apply a patch for the redraw issue with Margins on macOS 12.1

We may have soon a 22.1pr1 with those (or email me if you need it quicker)

1 Like

Is there anything more I can do to help with the focus issue? It’s sounding kind of hopeless right now.

You have a way to show the bug in our example project?
I’ve so far only seen it in your big project with containers.

After the buzz for the release is over, I may next week have more time to dig into a few of the reported bugs. I was very happy to quickly find the fix for the redraw issues on Monterey.

And I expect to see many more bug reports for Scintilla once it gets out and is tried by 100 people or so.

Sure, you just need to throw one on a container and embed it at runtime. Since I can’t attach projects here, I’ll email it to you. And just to be clear, I’m patient. I’m probably at least two months away from being able to ship a version of my app that would use it, and even if it’s not ready in time, I can retrofit it in later. Don’t feel rushed by me, I just want to help get this fixed because I can’t use it in this state.

1 Like

I may have found it for macOS. The active flag was not set the you created the control.
But that was set on app launch, so it worked for all our examples.

The problem was macOS only?

You know, I didn’t think to test other platforms. Windows works fine, I don’t have a Linux test VM setup. What do you recommend with the active property? Set it to true when I make the container visible?

it’s an active flag in the C++ class. We now set it on GotFocus if app is active.
That should fix the issue. Feel free to try pr1 once available.

Excellent, thank you.

Autocomplete in action:

3 Likes