From: Joe Y. <jyo...@jo...> - 2003-07-02 18:56:27
|
I'm finding that if I have a lot of text to display (write to the = control) and I have the SetWrapMode(1) for wrapping at word boundaries = and the text scrolls, the program will crash to an illegal operation. I've read on Scintilla documentation that the word wrapping doesn't take = place immediately...to quote: If a file is read and the scroll position moved to a particular line in = the text, such as occurs when a container tries to restore a previous = editing session, then the scroll position will have been determined = before wrapping so an unexpected range of text will be displayed. To = scroll to the position correctly, delay the scroll until the wrapping = has been performed by waiting for an initial SCN_PAINTED notification. How do I delay the scroll until the wrapping has completed? Here's some code: $this->{STC} =3D Wx::StyledTextCtrl->new( $ArticleEditingPanel, -1, [3, = 190], [750, 300] ); $this->{STC}->SetToolTip( "The Text of the Article" ); $this->{STC}->StyleSetFont(wxSTC_STYLE_DEFAULT, $font); $this->{STC}->StyleClearAll(); $this->{STC}->StyleSetSpec( wxSTC_H_DEFAULT, "fore:#000000" ); $this->{STC}->StyleSetSpec( wxSTC_H_TAG, "fore:#000088" ); $this->{STC}->StyleSetSpec( wxSTC_H_ATTRIBUTE, "fore:#000088" ); $this->{STC}->StyleSetSpec( wxSTC_H_COMMENT, "fore:#008800" ); $this->{STC}->StyleSetSpec( wxSTC_H_DOUBLESTRING, "fore:#880000" ); $this->{STC}->StyleSetSpec( wxSTC_H_SINGLESTRING, "fore:#880000" ); $this->{STC}->StyleSetSpec( wxSTC_H_VALUE, "fore:#880000" ); $this->{STC}->StyleSetSpec( wxSTC_H_NUMBER, "fore:#880000" ); $this->{STC}->SetLexer( wxSTC_LEX_HTML ); $this->{STC}->AddText( <<'EOT' ); <p>A year ago, three strokes separated Lafayette Sectional boys golf = tournament rivals Harrison, West Lafayette and Lafayette Jeff. <p>"It seems like when we play Jeff and Harrison, we play our best = golf," said West Lafayette senior Avery Boaz, who shot 77 in the 2002 = sectional. "We all play well at this course, and it also helps when you = are paired with excellent talent. <p>"We've shown we can put up good numbers, but in the end, It comes = down to how they feel about themselves during one round," Schneider = said. "The good thing about these pairings is that we will play with = West Lafayette, Jeff and Frankfort. <p>Don't be surprised if today's battle for sectional bragging rights at = the par 72 Lafayette Golf Course is every bit as close. <p>Twelve teams -- led by 2002 champion Harrison -- will compete for the = title, along with two other berths for the Lafayette Regional, set for = June 12. <p>But if recent form holds, Harrison, West Lafayette and Jeff are the = teams to beat. The Raiders won last year with a 311. West Lafayette shot = 313 and Jeff had 314. <p>"Sometimes, it's hard to get pumped up to play your best when you're = competing against someone you should beat." <p>In a sectional tuneup, Harrison defeated WL 318-325 in Wednesday's = dual meetat Coyote Crossing -- the Raiders' home course. Harrison = sophomore Clint Mathews shot 78, sharing medal honors with the Red = Devils' Tyler Ellis. <p>"Harrison is the team to beat ... very solid," Boaz said. "Jeff is = very solid, too. We are a little weaker than we've been in the recent = past, but we will be right there. <p>"We have a lot of fun during the regular season, but when it comes to = the sectional, we get ready for serious competition." <p>Jeff senior Nick Lundstrom, who shot 77 in helping the Bronchos win = the 2001 sectional by 17 strokes over second-place West Lafayette, is = eager to finish his high school career with a sectional title. <p>"Since we didn't win last year, we are going to be motivated," = Lundstrom said. "I think it's going to be really close between us, = Harrison, West Lafayette and Frankfort. <p>"We've been struggling a little bit lately, but we're starting to = turn things around. The championship is up in the air. Our area has = great competition, so it's going to come down to who is ready to play." <p>For Harrison coach Dave Schneider, four scores in the 70s always is = the goal. But in the sectional, that's a difficult task. The Raiders are = gunning for their third sectional title in six years. <p>"The kids will feed off each other. The competition and the challenge = is right there. I've told the guys to play one stroke at a time, do your = best and see what happens. We need to be close after nine holes." <p>Harrison is 12-1 in dual meets, won the Benton Central and McCutcheon = invitationals and placed third in the rugged Hoosier Crossroads = Conference tournament. <p>That's a strong sectional-contending resume, but Schneider = acknowledges that the Lafayette Golf Course -- with its huge elevated = greens -- is a different layout than the Raiders' Coyote Crossing. <p>"I don't know if our team enjoys the Lafayette Golf Course, but at = least they are familiar with it," Schneider said. "Sometimes, it drives = them crazy with those giant greens." EOT This will crash. But if you remove text so that the control doesn't have to draw a scroll = bar (vertical) then all is well. Any pointers? JY |