Scintilla is a very powerful (and stable) code editing component that supports syntax highlighting, code folding, tool tips and intellisense. Its packaged as a standard dll. Back in 2006 Stu Collier and Stewart released a nice ActiveX control named SCIVB.OCX that makes Scintilla directly usable for VB6 users.
This OCX is giant and complex. The DirectSci class alone is 70k+ lines of code! Also its a non-visual component making it a little more complex to use out of the box. They wrote a lot of code, and had to do a bunch of research into the internals of Scintilla. I have spent about 50hrs in the ocx codebase now and still only have a top level overview of it.
I found the control a couple years ago, and was a heavy end user of it while writing and using PDFStreamDumper. There were a couple nuances of the control that I always wanted to tweak, but never had the time to dive into the project. These last couple weekends I finally found that time and was able to really get into it. It also appears that the authors ceditmx.com website is no longer available, and the SourceForge page is so broken I had to download from a mirror. A Planet Source Code submission of what looks like a slightly older version is also still up. It would be a shame for all this hard work to disappear from the net, so I am including a copy of the original along with this project.
Below is a list of my edits, some rather extensive. I will start with notable bug fixes:
Window Handle Not Subclassed In IDE - I would constantly receive a modal Msgbox with this message when working in the IDE. It could pop 3 times right in a row. It may have been because I further wrapped the ocx controls in my own usercontrol. I disabled the message at the source, but after finding what was causing it, it turns out I could have preempted it in the IDE by adding the following to my UserControl_Initilize code: App.StartLogging Empty, vbLogOff . I will leave it disabled at the source because App.logevent causing a MsgBox as default logMode is obscure to me.
copy/paste support - the hot keys were unmapped, but they seem to have been buggy anyway. Previously I had to implement these functions myself in KeyPress event code, which was also buggy because Paste seemed to be called twice in a row. I had to track system time to not repeat in a given interval which was annoying. This appears to have been caused by the subclass being hooked into both before and after the original wndProc handler, hence causing the double event to fire.
arrow keys sporadically quite - This was a weird bug, I think it was caused by VB6 not knowing there was a manually created control on the user control canvas. It only happened sporadically but was super annoying for code navigation. I think the fix for this was UserControl.ForwardEvents = true. I havent seen it since, but that was super hard to find and I tried loads of stuff before then. Not even subclassing helped.
switched to visual component - Previously scivb was two components. A highlighter and a editor, both non visual. You had to drop both on a form and use them together. I have combined them into one visual component so you can just drag and drop it on a form like a normal control. Previously I always included my own usercontrol to wrap the ocx controls for simplicity of use.
simplified interface - the editor user control had tons of methods and properties. This increased the learning curve for the control and gave you more to sift through every time you used it. In this build I have removed a great deal of the ones I did not see myself using regularly. Most of these were also readily accessible through the DirectSCI class, Ones that required intimate knowledge of Scintilla internals were moved to a misc helper class. I also removed a bunch of events I didnt see myself using, renamed some functions for clarity, and included procedure attribute descriptions that will show up in the object browser for others.
lightened code base - The scivb authors didnt want to have any external ocx dependencies other than scilexer.dll which is smart. The internal options dialog however was pretty heavy with 3rd party user controls and had some other forms built in. I removed all of these from this build and trimmed off 400k in compiled size. I did create an external editor for the syntax files though.
Anyway, I think it is where I want it now so figured I would do a quick blog post on it. I did tentatively set binary compatibility on the component i am calling scivb_lite.ocx . Thanks again to the original authors for their hard work and research!
My modifications, as well as a zip of the original are available in the github repository.