TRichViewEdit as a single line edit box

General TRichView support forum. Please post your questions here
Post Reply
JLuckey
Posts: 12
Joined: Thu Feb 23, 2006 12:22 am

TRichViewEdit as a single line edit box

Post 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!
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Set RichViewEdit.VSmallStep := 1 (before calling Format)
JLuckey
Posts: 12
Joined: Thu Feb 23, 2006 12:22 am

Post 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..
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, you can use OnKeyDown to disable Up and Down keys.
Also, set WheelStep property = 0.
MLefebvre
Posts: 191
Joined: Mon Aug 29, 2005 4:28 pm
Location: France
Contact:

Post 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.
JLuckey
Posts: 12
Joined: Thu Feb 23, 2006 12:22 am

Post by JLuckey »

Trapping for the Down Arrow key in onKeyDown does the trick. I haven't tried setting ClientHeight.

Thanks for the suggestions...
Post Reply