Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

TppJITPipeline.OnGetFieldAsPicture never gets triggered

edited September 2005 in End User
Hi,

I dropped a TppDBImage component on a report, its attached to a
TppJITPipeline pipeline. In the TppJITPipeline.OnGetFieldAsPicture event i
assign the appropriate BMP to the TppDBImage component (code below), but the
OnGetFieldAsPicture event never gets called? What am i doing wrong?

Greetings,
Filip Moons

function TLEX23030F.ppDESCGetFieldAsPicture(aFieldName: String): TPicture;
var
AInteger: integer;
begin
Result := Nil;

if aFieldName = 'LYPLSTATUS' then
begin
if ppLYPLN.Active then
begin
AInteger := ppLYPLN.GetFieldValue(aFieldName);
if AInteger in [0..Pred(imgStatus.Count)] then
imgStatus.GetBitmap(AInteger,Result.Bitmap);
end;
end;
end; {ppDESCGetFieldAsPicture}

Comments

  • edited September 2005


    ----------------------------------------------------
    Tech Tip: Using the JITPipeilne OnGetPicture Event
    to display images
    ----------------------------------------------------

    Question
    --------

    I am using a JITPipeline to output data stored in a series of stringlists,
    one of these stringlists contains the names of a graphic.

    How can I use the JITPipeline.OnGetPicture Event to display an image?


    Solution
    --------

    1. Use JITPipeline fields editor to declare a Field with FieldType =
    dtGraphic. For this example, set the FieldName to 'Graphic'. Create a second
    Field with FieldType = dtString and set the FieldName to 'GraphicFile'.

    2. In the Report Designer, create a DBImage component and connect to the
    Graphic field.

    3. Use the Delphi code editor to declare a private variable for your form:

    private
    FPicture: TPicture;

    4. In the FormCreate event instantiate the picture object:

    procedure TForm1.FormCreate(Sender: TObject);
    begin

    FPicture := TPicture.Create;

    end;

    5. In the FormDestroy event, free the picture object:

    procedure TForm1.FormDestroy(Sender: TObject);
    begin

    FPicture.Free;

    end;


    6. In the JITPipeline.OnGetPicture event, load the picture:

    function TForm1.ppJITPipeline1GetFieldAsPicture(aFieldName: String):
    TPicture;
    var
    lsFileName: String;
    begin

    if aFieldName = 'Graphic' then
    begin
    lsFileName := JITPipeline['GraphicFile'];

    FPicture.LoadFromFile(lsFileName);
    end;

    Result := FPicture;

    end;



    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com

    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2005
    Thx Nard.

    Greetings,
    Filip Moons

This discussion has been closed.