Rich edit vertical scroll bar not working
-
Greetings I have a Rich Edit control for my app which I am using to Syntax Colorize SQL language whenever one SQL is opened in the editor. On every EN_CHANGE, i am lexing the SQL and colorizing it accordingly. The code I am using are - code: ----------------------------------------------------------------------------- if ( HIWORD ( pWPARAM ) == EN_VSCROLL ) { if ( pCQueryWnd->pCQueryEdit->uHiliting ) return 0; PostMessage ( pCQueryWnd->pCQueryEdit-uHWND, UM_CONTENT_CHANGE, 0, 0 ); } ----------------------------------------------------------------------------- This is written in its Parent Window WndProc. In the WM_VSCROLL message of the window I am having the following code snippet - code: ------------------------------------------------------------------------ case WM_VSCROLL: if ( !pCQueryEdit->uHiliting ) PostMessage ( pCQueryEdit->uHWND, UM_CONTENT_CHANGE, 0, 0 ); break; ----------------------------------------------------------------------------- I need to process VScrolling as I am doing only screenfull of highlighting for optimizations. Therefore whenever a user is pressing the Scroll button I am again Lexing screenful of text and colorizing it. Before highlighting I am using the following functions code: ----------------------------------------------------------------------------- pDoc->Undo( tomSuspend, NULL ); // dont record this into the undo stack pDoc->Freeze(&f); ----------------------------------------------------------------------------- After highlighting I am using code: ----------------------------------------------------------------------------- pDoc->Unfreeze(&f); pDoc->Undo( tomResume, NULL ); ----------------------------------------------------------------------------- In between I am highlighting part of text using the following method code:------------------------------------------------------------------------ ITextRange * textrange; ITextFont * font; pDoc->Range ( pStart, pEnd, &textrange ); textrange->GetFont ( &font ); font->SetForeColor( pColor ); font->Release(); textrange->Release(); ----------------------------------------------------------------------------- The problem is that VScroll does not work properly. IF I stop colorizing everything starts working. If I use the Mousewheel everything is working perfectly Note : This problem only happens when the screen is in the first line. I cant seem to scroll the first line up the
-
Greetings I have a Rich Edit control for my app which I am using to Syntax Colorize SQL language whenever one SQL is opened in the editor. On every EN_CHANGE, i am lexing the SQL and colorizing it accordingly. The code I am using are - code: ----------------------------------------------------------------------------- if ( HIWORD ( pWPARAM ) == EN_VSCROLL ) { if ( pCQueryWnd->pCQueryEdit->uHiliting ) return 0; PostMessage ( pCQueryWnd->pCQueryEdit-uHWND, UM_CONTENT_CHANGE, 0, 0 ); } ----------------------------------------------------------------------------- This is written in its Parent Window WndProc. In the WM_VSCROLL message of the window I am having the following code snippet - code: ------------------------------------------------------------------------ case WM_VSCROLL: if ( !pCQueryEdit->uHiliting ) PostMessage ( pCQueryEdit->uHWND, UM_CONTENT_CHANGE, 0, 0 ); break; ----------------------------------------------------------------------------- I need to process VScrolling as I am doing only screenfull of highlighting for optimizations. Therefore whenever a user is pressing the Scroll button I am again Lexing screenful of text and colorizing it. Before highlighting I am using the following functions code: ----------------------------------------------------------------------------- pDoc->Undo( tomSuspend, NULL ); // dont record this into the undo stack pDoc->Freeze(&f); ----------------------------------------------------------------------------- After highlighting I am using code: ----------------------------------------------------------------------------- pDoc->Unfreeze(&f); pDoc->Undo( tomResume, NULL ); ----------------------------------------------------------------------------- In between I am highlighting part of text using the following method code:------------------------------------------------------------------------ ITextRange * textrange; ITextFont * font; pDoc->Range ( pStart, pEnd, &textrange ); textrange->GetFont ( &font ); font->SetForeColor( pColor ); font->Release(); textrange->Release(); ----------------------------------------------------------------------------- The problem is that VScroll does not work properly. IF I stop colorizing everything starts working. If I use the Mousewheel everything is working perfectly Note : This problem only happens when the screen is in the first line. I cant seem to scroll the first line up the
I do not know how you handle the positions of the text you highlight, but I remember having had trouble while using
int
instead oflong int
to retrieve some text position. Maybe the cursor is also not at the proper place (just like if you click on the last line, and then move the scrollbar to the top using the mouse, the cursor position is still on the last line, making it acting weird if you hit an arrow key). ~RaGE();