New Blog Post: PDF/A and Metadata

programtype, childtype

edited February 2010 in RAP
Hi again,

in the last few days, I learned a lot about RAP.

Today, I would like to create a global procedure, e. g. like this:

procedure myProc (aString: string);
begin
ShowMessage(aString);
end;

Since now, I do like this:

lProgram:= lCodeModule.FindGlobalProgram('myProc');
if (lProgram = nil) then begin
lprogram:= traProgram.create;
lprogram.SourceLines.Clear;
lprogram.SourceLines.Add('procedure myProc(aString; string);');
lprogram.SourceLines.Add('begin');
lprogram.SourceLines.Add(' ShowMessage(aString);');
lprogram.SourceLines.Add('end;');

lCodeModule.AddProgram(lProgram);
lCodeModule.Build(false);
end;

I get no errors, but when opening the report in the designer and choose the
module view, i find myProc in the Event Handlers, but not in Global -
Programs, where I would expect it.

I saw the properties programtype and childtype, but didn't find any further
detail (rap.hlp, rbwiki etc.)

Thanks for help

Marion

Comments

  • edited February 2010
    Hi Marion,

    Try setting the ChildType property of the TraProgram to ctGlobalProgram.
    You will need to add raTypes to your uses clause.

    Different ChildType enumerations...

    ctConstProgram:
    ctVarProgram:
    ctCreateProgram:
    ctDestroyProgram:
    ctGlobalProgram:

    I will update the rbWiki to include this information.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.