wx.stc: Lexer and highlighting additional text areas

From: Robin Dunn <robin <at> alldunn.com>
Subject: Re: wx.stc: Lexer and highlighting additional text areas
Newsgroups: gmane.comp.python.wxpython
Date: 2005-01-13 19:05:38 GMT (48 weeks, 6 days, 10 hours and 24 minutes ago)

Franz Steinhäusler wrote:

Is there any way around? (use lexer and mark some words at the same time)

Have you tried using indicators to do your marking? I don't know if the lexers will interfere with them as well but it is probably worth a try. Indicators use the same style byte, but different bits, so the lexer may leave them alone.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Has anyone actually got this to work - I have not been able to use indicators and the Lexer at the same time: it appears that the Lexer resets the indicator bits.

Michael

Hi Michael,

I wanted to use indicators in SPE to underline realtime errors as you
type. After some puzzling I found out that the last style indicator
style works. If you would look in SPE’s source code _spe/sm/wxp/stc.py:

    #INDICATOR STYLES FOR ERRORS

    self.IndicatorSetStyle(2, wx_stc.STC_INDIC_SQUIGGLE)

    self.IndicatorSetForeground(2, wx.RED)

To underline an error with a red squiggle line, SPE uses in the same file:

def markError(self,lineno,offset):

    self.StartStyling(self.PositionFromLine(lineno-1), wx_stc.STC_INDICS_MASK)

    self.SetStyling(offset, wx_stc.STC_INDIC2_MASK)

    self.Colourise(0, -1)

I don’t know if the lexer claims the other indicators. (wx.stc provides
a way to balance the bits between styles and indicators). For example
if you copy the code of the indicators in the wxPython demo from stc1
to stc2 it doesn’t work. To see the indicator in action, try out the
latest SPE. It works very nice, but I hope to be able to use another
indicator for other things as well.

Hope this helps,

Stani

···

On 12/22/05, Michael Spencer mahs@telcopartners.com wrote:

From: Robin Dunn <robin alldunn.com>
Subject: Re: wx.stc: Lexer and highlighting additional text areas
Newsgroups: gmane.comp.python.wxpython
Date: 2005-01-13 19:05:38 GMT (48 weeks, 6 days, 10 hours and 24 minutes ago)

Franz Steinhäusler wrote:

Is there any way around?
(use lexer and mark some words at the same time)

Have you tried using indicators to do your marking? I don’t know if the

lexers will interfere with them as well but it is probably worth a try.
Indicators use the same style byte, but different bits, so the lexer
may leave them alone.


Robin Dunn

Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Has anyone actually got this to work - I have not been able to use indicators

and the Lexer at the same time: it appears that the Lexer resets the indicator bits.

Michael


To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org


http://pythonide.stani.be
http://pythonide.stani.be/screenshots

http://pythonide.stani.be/manual/html/manual.html

SPE Stani's Python Editor wrote:

···

On 12/22/05, Michael Spencer <mahs@telcopartners.com> wrote:

From: Robin Dunn <robin <at> alldunn.com>
Subject: Re: wx.stc: Lexer and highlighting additional text areas
Newsgroups: gmane.comp.python.wxpython
Date: 2005-01-13 19:05:38 GMT (48 weeks, 6 days, 10 hours and 24 minutes

ago)

Franz Steinhäusler wrote:

Is there any way around?
(use lexer and mark some words at the same time)

Have you tried using indicators to do your marking? I don't know if the
lexers will interfere with them as well but it is probably worth a try.
  Indicators use the same style byte, but different bits, so the lexer
may leave them alone.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Has anyone actually got this to work - I have not been able to use
indicators
and the Lexer at the same time: it appears that the Lexer resets the
indicator bits.

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Hi Michael,

I wanted to use indicators in SPE to underline realtime errors as you type.
After some puzzling I found out that the last style indicator style works.
If you would look in SPE's source code _spe/sm/wxp/stc.py:

        #INDICATOR STYLES FOR ERRORS
        self.IndicatorSetStyle(2, wx_stc.STC_INDIC_SQUIGGLE)
        self.IndicatorSetForeground(2, wx.RED)

To underline an error with a red squiggle line, SPE uses in the same file:
    def markError(self,lineno,offset):
        self.StartStyling(self.PositionFromLine(lineno-1),
wx_stc.STC_INDICS_MASK)
        self.SetStyling(offset, wx_stc.STC_INDIC2_MASK)
        self.Colourise(0, -1)

I don't know if the lexer claims the other indicators. (wx.stc provides a
way to balance the bits between styles and indicators). For example if you
copy the code of the indicators in the wxPython demo from stc1 to stc2 it
doesn't work. To see the indicator in action, try out the latest SPE. It
works very nice, but I hope to be able to use another indicator for other
things as well.

Hope this helps,

Stani

--
http://pythonide.stani.be
http://pythonide.stani.be/screenshots
http://pythonide.stani.be/manual/html/manual.html

That's it, thanks very much Stani. I had tried indicators 0 and 1, but not 2.

Michael