Don
 
The control is actually just a very complicated shell - it's flexibility also means you also need to do quite a bit of set up work.  Not only do you need to set the lexer, but you also need to set the keywords that you want highlighted.
 
For the SQL lexer, look at the Scinitlla source code - there are a number of lexers ("Lex*") in the "src" folder.  You don't need to know C++, you just need to dig around a bit, because there are 2 things you need to know - keyword groups and keywords themselves.
 
For you, right at the bottom of LexSQL.cxx, you will see sqlWordListDesc declared - this will give you your group numbers that control your keywords.  Once you know your group number (in this case "keywords" is value "0") you can then apply keywords to that group number - keywords are set as a space delimited string.
 
I'm not sure with the Sciboo implementation, but for my control I'd do the following:
 
scintilla.SetKeywords(0, "private protected public false true");
 
Now, for applying styles, there are numerous methods - StyleSetFore, StyleSetBack, etc.  There are a number of default styles you can set on the control, but you can also set styles on specific keyword groups.
 
So, in this example, looking at "include/SciLexer.h" in the Scintilla source, you can find the keyword constants you need - for SQL keywords it's SCE_SQL_WORD, or 5.  So, to make your keywords blue:
 
scintilla.StyleSetFore(5, Color.Blue);
 
That's a brief overview - I don't use the ScintillaNET version which I think has constants declared so you will probably be able to find what you need using ildasm to browse the assembly, but hopefully that gives you can idea.
 
Cheers
Matt



 
On 12/05/06, Don Smith <[EMAIL PROTECTED]> wrote:

Matt/Steve,

 

Thank you to both of you for directing me to the Sciboo project for the ScintillaNET.dll and SciLexer.dll.

 

I've got both of the DLLs added as references in a C# project in SharpDevelop and have added an instance of the editor to a form and am trying to figure out what I need to do at this point to switch to a language mode (specifically SQL in my case).  The .Lexer property (which I assume controls the active language) is an int and I'm unsure what value to use for SQL and/or what other resources I need for SQL support ( e.g. *.properties files a la SciTE?)

 

I looked at the code in CVS that Garret had referenced in a request for documentation that a Willy from Belgium had made ( http://comments.gmane.org/gmane.comp.lib.scintilla.devel/2921) but was unable to find anything that I could make sense of related to switching languages.  Matt had also posted a response referencing the original Scintilla C source header SciLexer.h.  a look at this revealed the line:

 

#define 
SCLEX_SQL 7

 

In my C# I did a (scite is my ScintillaNET editor object)….

 

Scite.Lexer = 7;

 

This didn't seem to have any effect on the editor (in terms of highlighting, coloring) which leads me to believe that there's more I need to be doing.

 

Any help in this would be greatly appreciated.

 

 

 

Don Smith
Database Engineer
(608)831-7880 x225
CPM Marketing Group Inc.
6720 Frank Lloyd Wright Ave. Ste. 200
Middleton, WI 53562

 


_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest



_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to