Solved

EM_LINESCROLL

Posted on 1999-01-22
7
1,700 Views
Last Modified: 2010-04-04
Hi everybody!
I'm having probs. I want to implement my own scroll events
to a TRichEdit Component. ( Let's call it RE1 ) By the way:
The direction I want to scroll is X (to the right), not Y (down)

Forget about RE1.ScrollBy( -7, 0), it doesn't bring up the result I want.
I tried RE1.Perform ( EM_LINESCROLL, 7, 0) but that doesn't bring up any result.

Strange enough a (EM_LINESCROLL 0, 10) does scroll the text up. As a matter of fact, it scrolls it right out of my RE1 Window, although the message EM_LINESCROLL is defined => "if the current line plus the number of lines specified by the cyScroll param ( 10 ) exceeds the total number of lines, the value is adjusted so that the last line is scrolled to the top."
Sorry, borlandinprise guys, not in my RE1 !

But back to my prob:
I also tried a SendMessage with EN_HSCROLL, but that doesn't bring up any effect either.

Any ideas why EM_LINESCROLL doesn't take any effect if I try to scroll to the right ?

Oh, by the way: EM_SCROLLCARET does work, but again isn't what I want.

Greetings, Oli
0
Comment
Question by:Oli2
  • 5
7 Comments
 
LVL 1

Author Comment

by:Oli2
ID: 1362809
Adjusted points to 100
0
 
LVL 1

Author Comment

by:Oli2
ID: 1362810
Edited text of question
0
 
LVL 1

Author Comment

by:Oli2
ID: 1362811
Edited text of question
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:Oli2
ID: 1362812
Adjusted points to 150
0
 
LVL 44

Accepted Solution

by:
bruintje earned 150 total points
ID: 1362813
Hi Oli,

I don't know why EM_LINESCROLL didn't work, couldn't find a direct right scroll command in any implementation except for the J++ class wrapper around the Richedit control.

Got to work it out myself, after trying ScrollWindowEx that worked with SB_PAGEDOWN I did the following

procedure TForm1.Button3Click(Sender: TObject);//button3 is the 3rd different implementation :O)
var
  CountLines: Integer;
  I  : Integer;
begin
  CountLines := 50; //your value
  try
    for I := 0 to Countlines - 1 do begin
      SendMessage(Richedit1.Handle, { HWND of the Memo Control }
        WM_HSCROLL, { Windows Message }
        SB_LINERIGHT, { Scroll Command }
        0) { Not Used }
    end;
  except on E: Exception do
      Showmessage('Error scrolling lines down the reason > ' + E.Message);
  end
end;

And it worked for scrolling to the right.
btw You can also use ScrollWindowEx in this way to scroll in two dimensions at the same time :O).

Why the EM_LINESCROLL didn't work I don't know, but I hope this will get you further.
:O)
brUINTje.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1362814
Or look at GetScrollInfo/SetScrollInfo...

Regards, Madshi.
0
 
LVL 1

Author Comment

by:Oli2
ID: 1362815
it works just perfect.
Thanx, bruintje.
Madshi: thanx also for your comment. I'll take a look at xxxScrollInfo also.

Greetings, Oli
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now