I am trying to make a RichEdit control automaticly horizontal scroll the text in view when caret is near right edge.

Here is the code I use:



invoke GetCaretPos,addr pt
invoke GetClientRect,hEdit,addr rect
mov eax,rect.right
sub eax,pt.x
.if eax<20
invoke SendMessage,hEdit,EM_GETSCROLLPOS,0,addr pt
add pt.x,70
invoke SendMessage,hEdit,EM_SETSCROLLPOS,0,addr pt
.endif


This works well if the text in RichEdit is less than 64k.

Any ideas?

KetilO
Posted on 2001-10-13 19:50:16 by KetilO
I can offer another bag full of richedit oddities ...

do you create a "RICHEDIT" or a "RichEdit32" window / control?
if the first, try the second.

Between the different DLL versions are also a lot of differences,
you could try to download some dlls from Internet and try them
out.
Posted on 2001-10-16 07:30:58 by beaster
Thanks beaster

I am using Rich Text Edit Control, v3.0. File version 5.30.23.1200

I solved the problem by using this code:



invoke GetCaretPos,addr pt
invoke GetClientRect,hEdit,addr rect
mov eax,rect.right
sub eax,pt.x
.if eax<20
invoke SendMessage,hEdit,EM_GETRECT,0,addr rect
sub rect.right,70
inc rect.left
invoke SendMessage,hEdit,EM_SETRECT,0,addr rect
invoke SendMessage,hEdit,EM_SCROLLCARET,0,0
add rect.right,70
invoke SendMessage,hEdit,EM_SETRECT,0,addr rect
.endif


KetilO
Posted on 2001-10-16 08:03:15 by KetilO