This project is read-only.

Custom Language

Topics: Developer Forum, User Forum
Jan 20, 2010 at 11:18 AM
Edited Jan 20, 2010 at 11:27 AM

My English is poor:(

How to appoint conformity of keywords and styles?

For example in language "mssql" style(13)  is appointed for keywords(0)

I do not use configuration files

 ColorBox.ConfigurationManager.Language = "cpp"

 ColorBox.Lexing.LexerName ="Container"

 ColorBox.Lexing.StyleNameMap.Add("user", 0)

 ColorBox.Styles("user").BackColor = Color.Aqua

ColorBox.Styles("user").ForeColor = Color.Red

ColorBox.Lexing.Keywords(0)="retvalue setvalue getvalue"

How to predetermine style  ("user")  for own type of the data (keywords(0)) ?


Please help:)


Jan 21, 2010 at 6:39 PM

The association of Keywords to a Style index is determined by the lexer. Unfortunately each lexer does it's own thing and it's not documented. If you look in ScintillaNET/Configuration/Builtin you'll see 2 folders that might help you. One lists the names of the keyword lists each lexer uses. The other is the list of named styles each lexer uses.

Usually you will see something that matches. For instance if you look in MSSQL's keyword list you'll see that line 6 has "Operators". Looking in the style names you'll also see a line that says Operator = 5. So

ColorBox.Lexing.Keywords(5) should by operators like "AND IN LIKE" and you should make your style name map


ColorBox.Styles("operator").ForeColor = Color.Blue

Now it just happens to be that the keyword # and style # are the same in this case, it usually isn't. Also it's not always obvious based on the names to make the association. If all else fails you have to look in Scintilla project's source code for the lexer and figure it out, it's not easy.


Jan 22, 2010 at 8:54 AM
Edited Jan 22, 2010 at 9:02 AM

Thank you!

Still pair of questions if it is possible

First question

In version ScintillaNet.dll at setting of a source data there is no change of the data when control property is changed

 Dim db As New Binding("Text", EdBodyDataSet.Tables("BodyTable"), "tBody", False, DataSourceUpdateMode.OnPropertyChanged)


<font size="2" color="#0000ff"><font size="2" color="#0000ff">


</font></font><font size="2" color="#0000ff">



BodyTable.ColumnChanged, New DataColumnChangeEventHandler(AddressOf Column_Changed)

We change the text in scintilla1, but in the table it remains invariable and handler  has no event
Private Sub Column_Changed(ByVal sender As Object, ByVal e As DataColumnChangeEventArgs)


End Sub

Second question

Scintilla1 is not "clickable" in miscrosoft visual studio 2005.

By "clicking" any control on the form event by default is created:  for datagridview - CellContentClick, for radiobutton - CheckedChanged


Jan 22, 2010 at 9:06 AM

1) Yes, Databinding is not supported

2) The default event is DocumentChanged, DoubleClicking works for me. You're using VB.NET though and I've never tried with that.

Jan 22, 2010 at 9:08 AM

Oh and did you get the keyword/style mapping worked out?

Jan 22, 2010 at 9:36 AM

Thank you, Chris

With styles and keywords I will try now... Has distracted on DataBindings:)