Correct way to make report interactive?

hsmhsm
edited March 2011 in FastReport 4.0
I've duplicated the code from the user manual but the ClickObject method in my program is not being called. (a breakpoint set on the first line is not even being hit).

I can get the FR4 demo code to work OK and can happily make alterations to it that work. I'm sure my code looks the same as the demo code so I must be missing something.

I'd really appreciate it if someboby can see what is wrong with this code below?

This is my type declaration
type
  TForm2 = class(TForm)
    frxDBDataset_LeagueTable: TfrxDBDataset;
    frxReportLeagueTable: TfrxReport;

    DataSource1: TDataSource;
    ADOQrySourceForLeagueTable: TADOQuery;
    procedure ShowLeagueTable;

    //This method handles mouse clicks in the report
    procedure frxReportLeagueTableClickObject(Page: TfrxPage; View: TfrxView; Button: TMouseButton; Shift: TShiftState; var Modified: Boolean);
  private
    { Private declarations }
  public
  end;

and this is my method declaration
procedure TForm2.frxReportLeagueTableClickObject(Page: TfrxPage; View: TfrxView; Button: TMouseButton; Shift: TShiftState; var Modified: Boolean);

var sql:string;
begin
if view.name = 'Memo23' then    //<---------- never reaches here no matter where I click in the report
  begin
    sql := SQL_LeagueTableBySurname;
    ADOQrySourceForLeagueTable.Close;  //put sql into query for report source
    ADOQrySourceForLeagueTable.sql.Clear ;
    ADOQrySourceForLeagueTable.SQL.Add(sql);
    frxReportLeagueTable.ShowReport(true);//show the report
  end;

(Added later) Looking closely I find that the example shown in the programmers manual - and in my code above, is actually slightly different from that in the demo program. In the demo program there is no 'page' parameter. The declaration instead is just
procedure MainReportClickObject(View: TfrxView; Button: TMouseButton; Shift: TShiftState; var Modified: Boolean);

Is this a mistake in the manual? It it only the one without the page parameter that works? In not what is the difference?

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.