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

ppDBRichText and SelAttributes

edited June 2006 in General
Hi,

I'm using Delphi 7 and RB 10.02

I use a ppDBRichText field to display a long name. In the BeforePrint event
of the ppGroupHeaderBand, I modify the SellAttributes as displayed below.
My problem is, when I run the report the second time, without quitting it,
the ppDbRichText component is blank. If I do not modify the SelAttibutes,
then it displays data for consecutive runs.


procedure TfrmSiteInfo.ppGroupHeaderBand2BeforePrint(Sender: TObject);
begin
with ppDBRichTextSiteName do
begin
SelStart := 0;
SelLength := Length(IBQV_GeositesInfo.FieldByName('SiteName').AsString);
SelAttributes.Color := clBlack;
SelAttributes.Size := 12;
SelAttributes.Name := 'Trebuchet MS';
SelAttributes.Style := [fsBold];
end;
end;



Regards,

Nols Smit

Comments

  • edited June 2006
    Hi Nols,

    As a test, try placing a break point where you define the SelLength in the
    event below and be sure it is a value above 0 when you run the report the
    second time.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2006
    I still have the problem that for consecutive runs the setting of SelLength
    seems to be ignored in the code below because with a breakpoint at the third
    last line, the values of s1 = 0 and s2 = -1 for the consecutive runs.


    procedure TfrmSiteInfo.ppGroupHeaderBand2BeforePrint(Sender: TObject);
    const sName:string = 'Whetever';
    var
    s1, s2: string;
    begin
    with ppRichTextSiteName do
    begin
    RichText := sName;
    SelStart := 0;
    SelectAll;
    s1 := IntToStr(SelLength);
    SelLength := Length(sName);
    s2 := IntToStr(SelLength);
    SelAttributes.Color := clBlack;
    SelAttributes.Size := 12;
    SelAttributes.Name := 'Trebuchet MS';
    SelAttributes.Style := [fsBold];
    end;
    end;


    Regards,

    Nols Smit

  • edited June 2006
    Hi Nols,

    It seems the Band.BeforePrint event does not fire late enough perhaps for
    the richtext component to contain the proper data. Try uisng the OnPrint
    event or OnGetRichText event of the ppDBRichText component and see if that
    gives you a better result.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2006
    I eventually found the cause of the problem (and also of EOSError: Code
    1400 Invalid window handle): ppDBRichText and ppDBRichText components give
    problems in a IntraWeb application. I nearly re-installed RB :)


    Regards,

    Nols Smit


This discussion has been closed.