Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Rich edit vertical scroll bar not working

Rich edit vertical scroll bar not working

Scheduled Pinned Locked Moved C / C++ / MFC
databasedata-structureshelpannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    insanely420
    wrote on last edited by
    #1

    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

    R 1 Reply Last reply
    0
    • I insanely420

      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

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      I do not know how you handle the positions of the text you highlight, but I remember having had trouble while using int instead of long 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();

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups