Solved

Scroll'ed down in memo

Posted on 2001-07-17
3
591 Views
Last Modified: 2008-02-07
I want to now if a TMemo is scroll'ed to the bottom.
I try to use SBM_GETPOS to get the possition

a := Memo1.Perform(SBM_GETPOS, 0, 0);

but it always returns 0, probaly because I don't send the message to the scrollbar.
0
Comment
Question by:sorentop
3 Comments
 

Accepted Solution

by:
Yunoshev earned 100 total points
ID: 6289742
Var Info:TScrollInfo;
begin
 Info.cbSize := SizeOf(TScrollInfo);
 Info.fMask := SIF_POS or SIF_RANGE or SIF_PAGE     ;
 GetScrollInfo(Memo1.Handle,SB_VERT,Info);
 If (Info.nMax = Info.nPos+Info.nPage-1 ) Then
  Begin
   
     You code........
   
  End;
0
 
LVL 2

Expert Comment

by:gallaghe
ID: 6289842
Use GetScrollInfo as shown below. Place two TMemo controls
on a form, place the code below in an event such as a
command button OnClick for instance and then scroll down or up to see the position by running the code. Hope this can help you.

Kevin


procedure TForm2.Button1Click(Sender: TObject);
var
  si: TScrollInfo ;
  dwError: DWORD ;
begin
  dwError := 0 ;
  si.fMask := SIF_ALL      ;
  si.cbsize := sizeof(si) ;
  if not GetScrollInfo(Memo1.Handle, SB_VERT, si) then
  begin
    dwError := GetLastError() ;
    Memo2.Clear ;
    Memo2.Lines.Add('Failed to get information') ;
  end else
  begin
    with Memo2 do
    begin
      Clear ;
      Lines.Add('min scrolling position ' + IntToStr(si.nMin)) ;
      Lines.Add('max scrolling position ' + IntToStr(si.nMax)) ;
      Lines.Add('scroll-box position ' + IntToStr(si.nPos )) ;  { This is it }
    end ;
  end ;
end;
0
 

Author Comment

by:sorentop
ID: 6289975
The -1 should be removed
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

9 Experts available now in Live!

Get 1:1 Help Now