Solved

Scroll'ed down in memo

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi application Soap connection 5 130
Magic Software info 18 142
URL for downloading Google Chrome for Win XP 2 232
Convert MS Word document to a PDF file 9 114
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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

685 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