Scintilla Class Readme Credits First I'd like to thank the original author of Scintilla and all those who have contributed to it. Scintilla can be downloaded from http://www.scintilla.org I'd really like to thank Steve McMahon the author and owner of VBAccelerator who helped me several times in developing this. What is Scintilla Scintilla is an excellent freeware and opensource DLL which offers full syntax highlighting support for virtually any language, with code folding, tips and more. What is this wrapper class? Scintilla has a vast ammount of features. In many languages these features are fairly easy to make use of. In Visual Basic this isn't the case. There have been a couple of attempts at controls written in Visual Basic to make use of Scintilla but they have been plagged with bugs and offer very little support for what Scintilla can do. Unfortunatly because of the way Scintilla works, writing a control to wrap it is difficult at best and tends to have problems. Think of it as putting a window, within a window within a window. This class does not by any means support all the features of scintilla. But it does work quite well and adding more features is easily done so updates can be made more readily. In a sense because of the way it is designed you can treat it much like a control. It just has no visual aspects within the VB editor. Some things to watch out for This class uses subclassing to capture messages from Scintilla. Thanks to Steve for not only writing the SSubTmr code but also for helping me to impliment it. Though I have had no instances where it crashed when running it in VB because of the setup a bug will likely cause the editor to close so if you are running it from the editor and changing code save often. The FindText Function I figure I'll go over this briefly as it's got quite a few optional values to it. Public Function FindText(txttofind As String, Optional ByVal findinrng As Boolean, Optional WrapDocument As Boolean = True, Optional CaseSensative As Boolean = False, Optional WordStart As Boolean = False, Optional WholeWord As Boolean = False, Optional RegExp As Boolean = False) As Long The txttofind is the string you pass containing what text you wish to find. findinrng is to find within selected text. WrapDocument will cause the class to start from the beginning of the document if it's not found between the current position and the end of the document. WordStart if set to true will tell it to ignore anything that starts with a word related character (a-z). WholeWord will tell it to only find the whole word and ignore anything where the search text is within another word. RegExp will search using regular expressions. Some things to try:
Important! I call this a class but it's really a bit of a generic term for it. This wrapper for scintilla actually includes the following files:
modHighlighter.bas and modIni.bas These two files are not really neccisary to use the control effectivly. The modIni is use only in modHighlighter to read a basic ini style langage setup file. The modHighlighter provides some basic functionality to load languages. Several language files are included in this demo to show you how it works. It's fairly generic code. It also includes an ExportToHTML function. Use that one at your own risk of time it's pretty slow :) Things I want to add More properties to setup basic features of scintilla easily Improve the speed of a few functions specificly ReplaceAll, and ExporttoHTML Build in more support for scintilla's features If you find any bugs please get onto http://www.ceditmx.com and go to the forums and post a bug report outlining which function is causing the problem and what your using it for so I can try to fix it asap. |