Hola jsc.
Cita:
Empezado por jsc
...
Si es cierto que puede llegar al final y no haber leído nada, ...
|
Si, eso es lo primero que pensé
... igual te pongo un ejemplo de una de las formas en que podrías implementarlo:
Código Delphi
[-]
...
type
TForm1 = class( TForm )
RichEdit1: TRichEdit;
Button1: TButton;
procedure FormCreate( Sender: TObject );
procedure RichEdit1KeyDown( Sender: TObject; var Key: Word;Shift: TShiftState );
procedure FormDestroy( Sender: TObject );
private
FOldWndProc : TWndMethod;
procedure FNewWndProc( var Message: TMessage );
procedure ReachedEnd( const Reach: Boolean );
public
end;
var
Form1: TForm1;
implementation
procedure TForm1.FormCreate( Sender: TObject );
begin
RichEdit1.Lines.LoadFromFile('SomeFile.rtf');
FOldWndProc := RichEdit1.WindowProc;
RichEdit1.WindowProc := FNewWndProc;
end;
procedure TForm1.ReachedEnd(const Reach: Boolean);
const
FLAGS = MB_ICONQUESTION or MB_YESNO;
CMSG = '¿ Seguro que comprende el texto ?';
begin
if not Reach then
Exit;
if MessageBox( Handle,PChar(CMSG), '', FLAGS ) = IDNO then
Application.Terminate;
end;
procedure TForm1.FNewWndProc( var Message: TMessage );
var
sPos: Integer;
sInfo: TScrollInfo;
begin
if Message.Msg = WM_VSCROLL then
begin
sInfo.cbSize := SizeOf( TScrollInfo );
sInfo.fMask := SIF_ALL;
GetScrollInfo( RichEdit1.Handle, SB_VERT, sInfo );
sPos := GetScrollPos( RichEdit1.Handle, SB_VERT );
ReachedEnd( ( sInfo.nMax = sInfo.Npage + sPos ) );
end;
FOldWndProc(Message);
end;
procedure TForm1.RichEdit1KeyDown( Sender: TObject; var Key: Word; Shift: TShiftState );
var
RE : TRichEdit;
Row: Integer;
begin
if ( Key in [ VK_DOWN, VK_NEXT ] ) then
begin
RE := TRichEdit( Sender );
Row := RE.Perform( EM_LINEFROMCHAR, RE.SelStart, 0 );
ReachedEnd( ( Row = RE.Lines.Count - 1 ) );
end;
end;
procedure TForm1.FormDestroy( Sender: TObjec t);
begin
RichEdit1.WindowProc := FOldWndProc;
end;
end.
Saludos