How to show the page corresponding to a click on a thumbnail

  • Hi:

    With a TWPRichText control I need to click on a thumbnail when LayouMode is wpThumbNailView, change to LayoutMode and show the corresponding page where the click was made.

    If the click was made over some text I want to position the cursor at the same place. If the click was made over areas with no text -or page numbers- I want the cursor positioned at the beggining of the corresponding page.

    I am using the following code, but it doesn't work:

    Code
    procedure TForm1.WPRichTextClick(Sender: TWPCustomRtfEdit; PageNo, X, Y: Integer; var Ignore: Boolean);
    begin
      if ( Sender.LayoutMode = wpThumbNailView ) then begin
         Sender.LayoutMode := wplayLayout;
         Sender.ScrollToPosition(Sender.CPPosition, X, Y);
      end; // if ...
    end;

    Kind regards,

    Carlos Borrero