More Scintilla questions
Scintilla is very powerful, but finding something in the documentation can be troublesome. let's summary a few questions from you guys around ScintillaControlMBS control:
How to show whitespace?
Please check ViewWS property and use the constants:
Can I overwrite whitespace colors?
You can use SetWhitespaceForeColor and SetWhitespaceBackColor methods to overwrite what the lexer sets.
How to show End Of Line characters?
Please check EOLAnnotationVisible property and set it to one of the modes:
How to remove a key mapping with Scintilla?
If you don't like a remove a default binding for a key, you can use ClearCmdKey method like this:
You combine the key code with the shifted bits for the modified keys. Above we use control, but you can just OR them together, if you need multiple.
How to change the color of the cursor for text inserts?
Well, the cursor where you enter text is named cared in Scintilla. Please check the CaretForeColor property for the color of the caret. Also check CareWidth for the width and CaretPeriod for the duration for blinking.
How to color the area for code folding?
This is a chequerboard, where two colors make the final coloring:
The FoldMarginColor and the FoldMarginHighlightColor colors are used together to draw the chequerboard pattern in the folder margin.
Which colors are considered as text and which as whitespace?
See WordCharacters and WhitespaceChars properties, which define what characters are considered words and what is whitespace. Default Whitespace includes space, return and tab characters.
How to control wrap mode?
See WrapMode property and the constants related to it.
Where may I find what styles to set for a lever?
You can lookup the source code of the open source Scite application to get inspired. Since Scite uses Scintilla as editor, you can easily translate their definitions to Xojo code:
e.g. for CSS you look on the properties for it:
Translation may go like this:
A line with "keywords3.*.css" setting it to a list of keywords may translate to an assignment to KeyWords(index) property.
Style definitons translate to the properties, e.g.
But if you look into the LexerConstants.txt file we include with the plugin, you can see that there are constants for CSS and you can replace 11 with SCE_CSS_IMPORTANT constant.