StyledTextCtrl and SQL Lexer

Does anyone have any experience using the StyledTextCtrl and the SQL Lexer ?

I can’t get the keywords to become highlighted and I am a little stumped on where to look next.

Here is what I have done so far;

  1. copied the demo to a working file

  2. changed the line self.SetLexer(wx.STC_LEX_PYTHON) to self.SetLexer(wx.STC_LEX_SQL)

  3. added my own keyword list with [‘SELECT’, ‘INSERT’, ‘UPDATE’, … etc]

  • updated the appropriate spots where the keyword module was referenced
  1. changed all of the appropriate commands dealing with styles to the corresponding wx.STC_SQL_**

This demo file runs fine (without errors) but the words in the keyword list don’t appear as bold.

If I set the lexer back to wx.STC_LEX_PYTHON then the keywords do become bold.

Based on the this brief description, does anyone have any hints/suggestions ?

···

Geoff Skerrett

Murray, Skerrett & Associates, Jonas Business Software

Phn: 902-461-0079 ~ Fax:902-461-9559 ~ Mob: 516-220-9723

The sql lexer is a little different in that the definition of the keywords is case sensitive. Change your keyword defs to all lower case (i.e ‘SELECT’ => ‘select’) and everything should be good.

Regards,

Cody

···

On Jul 31, 2007, at 11:19 AM, Geoff Skerrett wrote:

Does anyone have any experience using the StyledTextCtrl and the SQL Lexer ?

I can’t get the keywords to become highlighted and I am a little stumped on where to look next.

Here is what I have done so far;

  1. copied the demo to a working file
  1. changed the line self.SetLexer(wx.STC_LEX_PYTHON) to self.SetLexer(wx.STC_LEX_SQL)
  1. added my own keyword list with [‘SELECT’, ‘INSERT’, ‘UPDATE’, … etc]
  • updated the appropriate spots where the keyword module was referenced
  1. changed all of the appropriate commands dealing with styles to the corresponding wx.STC_SQL_**

This demo file runs fine (without errors) but the words in the keyword list don’t appear as bold.

If I set the lexer back to wx.STC_LEX_PYTHON then the keywords do become bold.

Based on the this brief description, does anyone have any hints/suggestions ?


Geoff Skerrett

Murray, Skerrett & Associates, Jonas Business Software

Phn: 902-461-0079 ~ Fax:902-461-9559 ~ Mob: 516-220-9723