• 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.
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);
  LinesInWindow = 11; // set this manually for now...
  i: integer;
  i := RichEdit1.Perform(EM_GETFIRSTVISIBLELINE, 0, 0);
  if (RichEdit1.Lines.Count - (LinesInWindow + 1)) < i then
    Button1.Enabled := True;
    Timer1.Enabled := False; // dont need this any more

Open in new window

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
chudmarekAuthor Commented:
cheers, worked a treat!

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