sorentop
asked on
Scroll'ed down in memo
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The -1 should be removed
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
var
si: TScrollInfo ;
dwError: DWORD ;
begin
dwError := 0 ;
si.fMask := SIF_ALL ;
si.cbsize := sizeof(si) ;
if not GetScrollInfo(Memo1.Handle
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;