We've developed an application using wxPython 2.6.1.0 for text
postprocessing. The application is running on Windows 2000 and uses a
wxStyledTextCtrl (Scintilla) for text editing. For simple colorization I
use 'SetLexer(wxSTC_LEX_CONTAINER )' and a STYLENEEDED event handler.

This works very nicely, with one exception:
If the window containing the Scintilla control is partly off the screen,
the content doesn't get repainted properly: E.g. when moving some other
window across the Scintilla control, the content of that other window
appears in the text area of the Scintilla control. If I move the Scintilla
control back into the middle of the screen, until it's fully visible, the
repainting works fine.
This behaviour is definitely connected to the STYLENEEDED handler. If I
remove it, everything is OK.
I tried to add a Refresh command to the end of the STYLENEEDED handler. It
works,  but slows down scrolling a lot.

One more observation: The line numbers in the left margin are repainted
correctly.

I'd appreciate your help very much.

Winnfried

This is my code:


class BaseDocument(wxStyledTextCtrl):
    def __init__(self,parent, main, ID):
        wxStyledTextCtrl.__init__(self,parent,ID)
        .
        .
        .
        self.SetMarginLeft(0)
        width = self.TextWidth(wxSTC_STYLE_LINENUMBER,"9999999")
        self.SetMarginWidth(0,width)
        self.SetSelBackground(1, "cyan")

        self.SetLexer(wxSTC_LEX_CONTAINER )

        EVT_STC_CHANGE(self,ID,self.OnChange)

        EVT_STC_STYLENEEDED(self,ID, self.OnStyle)


    def OnStyle(self,event):
        oldend =
self.PositionFromLine(self.LineFromPosition(self.GetEndStyled()))
        pos = event.GetPosition()
        text = self.GetTextRange(oldend, pos)
        self.StartStyling(oldend, 0xff)
        self.SetStyling(pos-oldend, 2)
        start = 0
        while 1:
            mo = RXHIG.search(text,start)
            if mo:
                self.StartStyling(oldend + mo.start(), 0xff)
                self.SetStyling(mo.end() - mo.start(), 1)

                start = mo.end()
            else:
                break

Winnfried Hasel


Phone: +49 621 60-42763, E-Mail: [EMAIL PROTECTED]
Postal Address: BASF Aktiengesellschaft, GVW/B - C006, D-67056,
Ludwigshafen, Germany


BASF - The Chemical Company


BASF Aktiengesellschaft, Registered Office: 67056 Ludwigshafen, Germany
Companies' Register: Amtsgericht Ludwigshafen, HRB 3000
Board of Executive Directors:
Juergen Hambrecht, Chairman; Eggert Voscherau, Vice Chairman;
Kurt W. Bock, John Feldmann, Andreas Kreimeyer, Klaus Peter Loebbe, Stefan
Marcinowski, Peter Oakley
Chairman of the Supervisory Board: Juergen Strube

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

Reply via email to