rbWiki > RAP > Fundamentals > How To...Find Components With RAP Code

How To...Find Components With RAP Code

Table of contents
  1. 1. Question 
  2. 2. Solution

Question 

"How do I determine if the report components have RAP code associated with them?" 

Solution

Gain access to the TraCodeModule object using the raGetCodeModule routine, then loop through each program in the Programs list.  Use the TraProgram.Component.Name property to determine which components have RAP code associated with them.

Download: ComponentsWithRAPCode.zip  

Sample Delphi code:

procedure TForm1.btnGoClick(Sender: TObject);
var
  lCodeModule: TraCodeModule;
  lProgram: TraEventHandler;
  liIndex: Integer;
begin

  {get the code for the report}
  lCodeModule := raGetCodeModule(ppReport1);

  {event-handlers}
  for liIndex := 0 to lCodeModule.ProgramCount-1 do
    begin
      lProgram := TraEventHandler(lCodeModule.Programs[liIndex]);

      {Show Components with RAP event code}
      ShowMessage(lProgram.Component.Name);
   end;

end;
Tags
none

Files (0)

 
You must login to post a comment.