Solved

Scroll'ed down in memo

Posted on 2001-07-17
3
592 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

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

943 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

3 Experts available now in Live!

Get 1:1 Help Now