I have a problem with a StyledTextCtrl freezing on me.
If I type really fast in my StyledTextCtrl, it will sometimes freeze
and not update the display. If I touch the vertical scrollbar and move
it at least one pixel the widget un-freezes. I can't quite figure out
what triggers this -- long lines, unusual styling, unicode characters,
etc. I can make it happen with fast typing, but only sometimes. For
example, if I delete everything in the buffer and type fast nothing
bad happens. If I have a lot of styled text (and by 'a lot' I mean
only a few dozen lines) the problem rears its ugly head, but not if
I'm typing in the last few lines of the buffer (seemingly).
I have a lot of key bindings and am doing my own text styling and am
wondering if maybe there's some method I'm supposed to call after
certain types of events in order to keep the display up to date. I've
removed all instances of calls to Freeze and Thaw thinking maybe I've
accidentally forgotten to thaw at some point; I've also tried calling
Thaw() after every keypress to no effect.
If I put print statements in my code I see that my keyboard event
handlers continue to fire while the display is frozen, and the
horizontal scrollbar changes as my data entry causes the line to grow,
so I don't think it's my code that's stuck in an infinite loop. It's
just that the display refuses to update.
I have a problem with a StyledTextCtrl freezing on me.
If I type really fast in my StyledTextCtrl, it will sometimes freeze
and not update the display. If I touch the vertical scrollbar and move
it at least one pixel the widget un-freezes. I can't quite figure out
what triggers this -- long lines, unusual styling, unicode characters,
etc. I can make it happen with fast typing, but only sometimes. For
example, if I delete everything in the buffer and type fast nothing
bad happens. If I have a lot of styled text (and by 'a lot' I mean
only a few dozen lines) the problem rears its ugly head, but not if
I'm typing in the last few lines of the buffer (seemingly).
I have a lot of key bindings and am doing my own text styling and am
wondering if maybe there's some method I'm supposed to call after
certain types of events in order to keep the display up to date. I've
removed all instances of calls to Freeze and Thaw thinking maybe I've
accidentally forgotten to thaw at some point; I've also tried calling
Thaw() after every keypress to no effect.
Don't do this, I cant see any reason that you should be doing a
freeze/thaw especially in your keyprocessing.
I would suspect your styling since you said it starts freezing after
you have a number of lines in the buffer.
How are you doing it? Are you using the container lexer and the
EVT_STC_STYLENEEDED event to do the styling? If not you should be.
It should be easy to determine if this is the cause if you just
disable your styling and see if the issue is still there or not
afterward.
If I put print statements in my code I see that my keyboard event
handlers continue to fire while the display is frozen, and the
horizontal scrollbar changes as my data entry causes the line to grow,
so I don't think it's my code that's stuck in an infinite loop. It's
just that the display refuses to update.
Has anybody seen this before?
No
Cody
···
On Fri, Mar 26, 2010 at 11:05 AM, Bryan Oakley <bryan.oakley@gmail.com> wrote:
Yes, I'm using the container lexer and binding to EVT_STC_STYLENEEDED.
I've discovered that adding "self.Refresh()" at the end of my
OnStyleNeeded method makes the problem go away (I think; I've only
tested it briefly)
···
On Fri, Mar 26, 2010 at 11:12 AM, Cody Precord <codyprecord@gmail.com> wrote:
Don't do this, I cant see any reason that you should be doing a
freeze/thaw especially in your keyprocessing.
I would suspect your styling since you said it starts freezing after
you have a number of lines in the buffer.
How are you doing it? Are you using the container lexer and the
EVT_STC_STYLENEEDED event to do the styling? If not you should be.