wxStyledTextCntl lexing - how to colour additional keywords

20 views Asked by At

I have a wxStyledTextCntl window pane containing a restricted set of JavaScript. I am successfully lexing it to colour keywords. Additionally, I colour unsupported JavaScript keywords and functions which are the API into the host application. Abstracting the relevant bits of code and shortening the lists, I have

pane->SetLexer(wxSTC_LEX_CPP);
wxString keywordsSupported = "arguments boolean break case catch const continue";
wxString keywordsUnsupported = "abstract byte char class";
wxString extensionNames = "print alert messageBox";
pane->SetKeyWords(0, keywordsSupported);
pane->SetKeyWords(1, keywordsUnsupported);
pane->SetKeyWords(3, extensionNames);
pane->StyleSetForeground(wxSTC_C_WORD, wxColour(28,120,255));// blue for supported keywords
pane->StyleSetForeground(wxSTC_C_WORD2, wxColour(255,118,0));  // orange for unsupported keywords
pane->StyleSetForeground(wxSTC_C_GLOBALCLASS, wxColour(132, 0, 255));  // purple for extensions

I cannot remember how I came to the 0,1 & 3 values for the style numbers nor the wxSTC_C macros but this all works wonderfully well.

However, I now want to add a further deprecated list but cannot work out how to define an extra style and what to use in the StyleSet. I think my existing code uses spare numbers or values not otherwise used.

Guidance on how to colourise a further list of words would be much appreciated.

0

There are 0 answers