How can I scroll the contents of a Memo component?

I'm making a simple text viewer....
I need to implement a text scroll
/for instance scroll the window one line, when CTRL+DOWNKey is pressed/..but to leave the cursor position the way it is....also I dont want a scrollbar ot anything like that....or at least - how can I hide the scroll bar of a memo component?
TL010600Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kretzschmarCommented:
hi tl,

for hiding the scrollbar, adjust the property Scrollbars to ssNone or ssHorizontal (if this scrollbar wanted).

to perform a linescroll use this method

memo1.perform(EM_LineScroll,0,1); //or -1 to scrollup

for the keyevent it looks like

procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if ssCtrl in shift then
  begin
    If Key = VK_Down Then
    begin
      memo1.Perform(EM_LineScroll,0,1); //scroll one line down
      Key := 0;
    end else
    If Key = VK_Up Then
    begin
      memo1.Perform(EM_LineScroll,0,-1); //scroll one line up
      Key := 0;
    end;
  end;
end;

meikl
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hubdogCommented:
also you can use memo1.scrollby(deltax,deltay);to scroll

hubdog
0
TL010600Author Commented:
Thanx fella!
I couldnt find this EM_LineScroll!
I searched all documents including win32 programming reference, but no luck? I guess my searches aren't effective :(
THANX!
0
kretzschmarCommented:
hi tl,

thanks for accepting ;-)

i forgot to mention that it could be that you should include the unit richedit in the uses clause, there is the constant defined.

for further explaination look in the win32.hlp file under
rich edit control reference

meikl
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.