Solved

Scroll'ed down in memo

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

772 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