[wxPython-users] wxStyledText questions...
Robin Dunn
robin at alldunn.com
Sun Dec 3 16:26:29 PST 2006
Greg Skelhorn wrote:
> From what I have found via google searches I believe I want
> to set the stc lexer to SCLEX_CONTAINER and write the
> logic for my custom syntax styling in an event handler for
>
> SCN_STYLENEEDED.
>
> Am I on the right path? Can anyone point me to
> some docs or a similar example?
IIRC, when you get the style-needed event you should set the styles up
to the event.GetPosition() position in the document. You can keep track
of the last position you set the styling up to and only do the styles
from that position to the one passed in the event.
To set a style for a range of text you use StartStyling(pos, mask) where
pos is the beginning of the range, and mask is a bitmask specifying
which of the style bits should be set. (This allows you to set styles
but leave the indicator bits untouched, etc.) You then use
SetStyling(length, style) to set length style bytes to style.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list