• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1929
  • Last Modified:

Memo Or Rich Edit

Hi All,

I am trying to add a click thru licence agreement on a certain page of my software. (I am using c++ builder 6)

I am currently using a RichEdit (but am open to using a memo)
I have my licence information in the richedit box, an "I agree" checkbox and a continue button.
The "I agree Button" is disbaled and my "Continue" button is also disabled.
I would like:

The "I agree" button to be enabled only when the user uses the vertical scroll bar, and that scroll bar hits the bottom (therefore assuming the whole thing has been read)

How do I get the richEdit to detect that its at the end of the document/or the bottom of the scroll bar.

Thanks in advance.
0
chudmarek
Asked:
chudmarek
1 Solution
 
TheRealLokiSenior DeveloperCommented:
Here is 1 way to do it
place a TTimer on the form, and set it's interval to 100 (1/10th of a second)
procedure TForm1.Timer1Timer(Sender: TObject);
const
  LinesInWindow = 11; // set this manually for now...
var
  i: integer;
begin
  i := RichEdit1.Perform(EM_GETFIRSTVISIBLELINE, 0, 0);
  if (RichEdit1.Lines.Count - (LinesInWindow + 1)) < i then
  begin
    Button1.Enabled := True;
    Timer1.Enabled := False; // dont need this any more
  end;
end;

Open in new window

0
 
Jose ParrotGraphics ExpertCommented:
The Windows function
         int GetScrollPos( HWND hWnd, int nBar );
returns the position of the scrollbar.
Right now (I'm in the office) I don't have access to my PC which has Builder 6. If until night you don't have an answer, I'll try to check it. Anyway, you may want take a look at http://www.functionx.com/win32/controls/scrollbars.htm
Jose
0
 
chudmarekAuthor Commented:
cheers, worked a treat!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now