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

Preview Form Status Bar

edited March 2006 in General
My application is doing some additional processing in the
OnReceiveAutoSearchField event of a TrsClientReport. I'd like to update the
status bar on the preview form to reflect the processing instead of
"Accessing Data..." I'm thinking this should be something like: (Sender as
TrsClientReport).PreviewForm.Statusbar.Text ??

Is this possible? Is the Preview accessible in the OnReceiveAutoSearchField
event or is there a better place to do some processing and update the status
bar?


Thanks! RB 7 Server / TrsClientReport

Comments

  • edited March 2006

    I have not tried it but that sounds like a valid approach.

    - include some code to check whether the PreviewForm is nil

    - Typecast the Previewform as TppPrintPreview

    Example:

    uses
    ppPrvDlg;

    lPreviewForm: TppPrintPreview;

    lClientReport := TppClientReport(Sender);

    if (lClientReport.PreviewForm <> nil) and (lClientReport.PreviewForm is
    TppPrintPreview) then
    begin
    lPreviewForm := TppPrintPreview(lClientReport.PreviewForm);

    lPreviewForm.StatusBar (add more code here)

    end;




    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2006
    Was TppClientReport introduced in RB 7? I can't seem to find the declartion
    for it so this won't compile. (I have a license for RB10 Server but just
    haven't gotten there yet :-) Or maybe I'm not following...


    var
    lPreviewForm: TppPrintPreview;
    lClientReport: TppClientReport; <-- Undefined.
    begin

    lClientReport := TppClientReport(Sender);

    if (lClientReport.PreviewForm <> nil) and (lClientReport.PreviewForm is
    TppPrintPreview) then
    begin
    lPreviewForm := TppPrintPreview(lClientReport.PreviewForm);
    lPreviewForm.StatusBar.Caption := 'Got to here';
    end;
  • edited March 2006
    My mistake, should be TrsClientReport.




    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2006


    Yes, that makes more sense.

    So how can I locate the statusbar on the previewform, it doesn't look like
    it's exposed...?

    This works: lPreviewForm.Caption := 'Got to here';

    This doesn't: lPreviewForm.StatusBar ....


    Than ks for your help.
  • edited March 2006

    In recent versions the default PreviewForm includes public properties that
    provide access to the statusbar and other controls.

    There are two approaches that you could use:

    1. Create a custom preview form that declares a public StatusBar property.

    2. In the VCL, all TWinControl descendants have a Controls[] array that
    provides access to the child control contained by the control. Therefore you
    can loop thru the PreviewForm.Controls[] array and find the StatusBar
    object.




    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.