Home Component Writing
New Blog Posts: Merging Reports - Part 1 and Part 2

CreateDefaultFields

edited November 2006 in Component Writing
Hio!

Another day, another problem - That's why I'm developer, isn't it?

Here we go:
I have derived a Pipeline (based on CustomDataPipeline) and rewritten
"CreateDefaultFields"-routine. Works fine, but the (default) FieldEditor
doesn't catch my changes - Delphi's Object-hierarchy and standard TppReport
catches them correctly.

Now how to synchronize the FieldEditor?

Regards,
Sebastian Kranz.

Comments

  • edited November 2006
    Hi Sebastian,

    The component editor of the DataPipeline is updated when the PropertyChanged
    routine is called. If you take a look at the TppCustomDataPipeline class,
    you will see that PropertyChanged is overridden. I believe one of the
    places this is called is when a field is altered. Try tracing through your
    custom code and be sure this is being called as the fields are being added
    to the pipeline as it is in ReportBuilder.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2006
    Hi Nico,

    here's my 'CreateDefaultFields'-routine as I'm currently using it:
    procedure TAVSBoldDataPipeline.InternalCreateDefaultFields;
    var
    I,J: Integer;
    myField : TppField;
    ClassTypeInfo: TBoldClassTypeInfo;
    begin
    FCreatingDefaultFields := True;
    J := 0;
    if FieldCount > 0 then begin
    FreeFields;
    end;
    if IsBoldListHandle(BoldHandle) then begin
    with BoldHandle as TBoldListHandle do begin
    ClassTypeInfo := TBoldClassTypeInfo(ListElementType);
    for I := 0 to ClassTypeInfo.AllMembers.Count - 1 do begin
    if ClassTypeInfo.AllMembers[I].IsAttribute then begin
    myField := TppField.Create(GetChildOwner);
    with myField do begin
    FieldName := ClassTypeInfo.AllMembers[I].ExpressionName;
    FieldLength := 50;
    DisplayWidth := 50;
    Position := J;
    DataPipeline := Self;
    FieldAlias := FieldName;
    Searchable := True;
    Sortable := True;
    Name := Self.Name + 'Field' + IntToStr(J);
    PropertyChange;
    end; // with myField do..
    end; // if ClassTypeInfo.allMembers[I]..
    inc(J);
    end; // for I := 0 to ClassTypeInfo...
    end; //with BoldHandle as...
    end; // if IsBoldListHandle...
    FCreatingDefaultFields := False;
    DoOnDataChange;
    end;

    I've registered FieldEditor with
    'ppRegisterComponentDesigner(TppFieldEditor, TAVSBoldDataPipeline);'
    but if I call PropertyChange; ComponentDesigner is nil.




    --- posted by geoForum on http://delphi.newswhat.com
  • edited November 2006
    This conversation will be continued via email.

    --
    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.