Page 1 of 1

TRichViewEdit as a single line edit box

Posted: Wed Jun 14, 2006 11:19 pm
by JLuckey
I'm using a TRichViewEdit (ver 1.9.15) as a single-line edit box and preventing word wrap w/ the following code:

for i := 0 to RVStyle1.ParaStyles.Count-1 do
RVStyle1.ParaStyles.Options := RVStyle1.ParaStyles.Options+[rvpaoNoWrap];
RichView1.Reformat;

(which works great)

However I am able to scroll the text in the box vertically about one-half of a line using the up and down arrow keys.

How do I prevent this vertical strolling?

Thanks!

Posted: Thu Jun 15, 2006 1:40 pm
by Sergey Tkachenko
Set RichViewEdit.VSmallStep := 1 (before calling Format)

Posted: Thu Jun 15, 2006 4:31 pm
by JLuckey
That's a little better.

Now instead of moving one-half of a line, the text only moves a small distance when I use the up/dn arrow keys. I tried setting VSmallStep := 0 (didn't work).

Do you have any other suggestions? Should I trap for the arrow keys & disabale them?

thanks..

Posted: Sat Jun 17, 2006 7:19 am
by Sergey Tkachenko
Yes, you can use OnKeyDown to disable Up and Down keys.
Also, set WheelStep property = 0.

Posted: Sat Jun 17, 2006 8:10 am
by MLefebvre
FYI : I have been fighting this (small) problem for hours ... Finally found 2 ideas, maybe one of them is suffcient :
- Setting RV.ClientHeight to DocumentHeight+VSmallStep+1
- Adding RV.ScrollTo(0) in various events (key handler, OnChange). In your case, maybe you could use the OnCaretGetOut event.

Posted: Sat Jun 17, 2006 11:21 pm
by JLuckey
Trapping for the Down Arrow key in onKeyDown does the trick. I haven't tried setting ClientHeight.

Thanks for the suggestions...