RichEdit/HSCROLL & EXSETSEL

RichEdit/HSCROLL & EXSETSEL

Post by Stee » Tue, 12 Nov 1996 04:00:00




> Hi,
> I'm working with a multiline richedit control and am trying to
> format a line of text WITHOUT scrolling the text into view.
> The control is created with,
> hwndEdit = CreateWindowEx( WS_EX_ACCEPTFILES,                      
>                  "RichEdit",
>                   NULL,                        
>                   WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL | ES_AUTOVSCROLL |
>                   ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL |
>                   ES_SAVESEL | ES_NOHIDESEL,                      
>                   0, 0, rect.right, rect.bottom,                      
>                   hwnd,
>                   (HMENU)IDC_EDIT,
>                   hInst, 0 );
> before formatting the text I do,
> LONG style = GetWindowLong( hwndEdit, GWL_STYLE );
> style ^= ES_AUTOHSCROLL;
> SetWindowLong( hwndEdit, GWL_STYLE, style );
> at this point I figured the text would not scroll
> beyond the extent of the control with a call to,
> CHARRANGE cr;
> cr.cpMin = someValueBeyondTheEdgeOfTheControl;
> cr.cpMax = cr.cpMin+1;
> SendMessage( hwndEdit, EM_EXSETSEL, 0, (LPARAM)&cr );

I just discovered that its a subsequent message to
EM_SETCHARFORMAT that is causing the scroll, if the
range specified in cr is not visible.

Still no success in preventing this behaviour though.

Quote:> After I do this I faithfully set the autohscroll
> value back on.
> style ^= ES_AUTOHSCROLL;
> SetWindowLong( hwndEdit, GWL_STYLE, style );
> The problem is that the control DOES scroll, which
> is very annoying.  Does anyone know how to prevent
> this?

--

+--------------------------------------------------------------------+
If you ever drop your keys into a river of molten lava, let 'em go,
because man, they're gone.  -- Jack Handey
 
 
 

1. книга c\с++

нужны
линки на subj
(не visual)по
программированию
сокетов и
для
написания
софта для tcp\ip
и вообще
для сети(!!!не
локально-вычислительных).
ответы
кидать на

2. startup folder

3. &&& Moles and Mazes &&&

4. Services

5. مثففشق

6. commas not ignored in (Full Name, Jr.)

7. учебник по с\с++

8. EMM386 Question (Again)

9. RichEdit 2.0 drag & drop problem

10. RichEdit 2.0 CharFormat2 & Multiple Undo

11. RichEdit & Asian symbols

12. Richedit 2.0 & Russian

13. RichEdit & Font Common Dialog