Change Properties of all objects

Hi,
Please help. How to change properties of all objects before print.

Something like this:

int max=frxReport1->ComponentCount;
for (int i = 0; i <= max; i++) {
frxReport1->Components ... Top=1,12; //<- how

}
frxReport1->Print();

How it is working?

Thank You
Pinda

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 11:40PM
    A report design consists of a heirachal structure of objects.
    page, objects on page "bands or other objects", objects within objects on the page "memoviews in bands". Meaurements like "top", are relative to the object's parent object and not necessarily related to where they are located on the output page.
    What are you really trying to accomplish?
    ;)
  • edited 11:40PM
    A would like to make report for printing to forms. And many printers printing from other offset (Top and Left). And I need to develop setting of this ofset for different printers.

    one printer printing to form right, but other printer printing 5mm down from top. I want to set in my application this difference.

    I know how to do it like this example:
    ((TfrxMemoView*)frxReport1->FindObject("MemoTo1"))->Top+=0.5;
    ((TfrxMemoView*)frxReport1->FindObject("MemoTo2"))->Top+=0.5;
    ...
    ((TfrxMemoView*)frxReport1->FindObject("MemoTox"))->Top+=0.5;

    But by me it is not good way to set direct to all components.
    I would like to do it by cycle, but I do not know how?
    Please help.
  • gordkgordk St.Catherines On. Canada.
    edited 11:40PM
    here is a short sample
    procedure TForm1.Button1Click(Sender: TObject);
    var
    //declare var of types needed
    ob:tobject;
    bnd:Tfrxpageheader;
    i,b1,c1:integer;
    obname:string;
    pg:tfrxReportpage;
    begin
    frxreport1.LoadFromFile(wpath+'2.fr3');
    for i := 0 to frxreport1.Objects.Count-1 do
    begin
    ob:=frxreport1.Objects; // find the page
    if ob.ClassName = 'TfrxReportPage' then
    Pg := frxReport1.Pages as TfrxReportPage;
    // find a band
    if pg.FindBand(TfrxPageHeader)<> nil then
    begin
    bnd := pg.FindBand(TfrxPageHeader)as tfrxpageheader;
    // iterate band objects here in the same manner

    end
    else
    begin
    // add band and memo here since band did not exist
    end;
    end;
    frxreport1.ShowReport;
    end;

    generally to shift all objects down or left by the same amount it is usually sufficient to just alter the page's
    top and left margin settings.

  • edited 11:40PM
    It does not work.

    But I tryed this:
    void __fastcall TFormMain::frxReport1BeforePrint(TfrxReportComponent *c)
    {
    TfrxMemoView* mv;
    AnsiString s=c->ClassName();
    if(s=="TfrxMemoView")
    {
    mv=(TfrxMemoView*)c;
    mv->Top=mv->Top+(StrToFloat(EditTop->Text)/10);
    mv->Left=mv->Left+(StrToFloat(EditLeft->Text)/10);
    }
    }

    and it is also does not work. Please Help how to do it.
    Stan
  • edited 11:40PM
    I also tried this function:

    bool TFormMain::Move(int x, int y)
    {
    for (int i=0;frxReport1->Objects->Count-1;i++)
    {
    if (frxReport1->Objects.ClassNameIs("TfrxMemoView"))
    {
    ((TfrxMemoView*)frxReport1->FindObject(frxReport1->Objects))->Top+=y; // error
    ((TfrxMemoView*)frxReport1->FindObject(frxReport1->Objects))->Left+=x; //error
    }
    }
    return true;
    }

    but with error:
    [C++ Error] E2034 Cannot convert 'TList' to 'AnsiString'

    Please help!!!
  • edited 11:40PM
    TfrxMemoView * Memo = NULL;
    
       for(int idx = 0;idx < frxReport1->Pages[0]->AllObjects->Count;idx ++)
         if (Memo = dynamic_cast <TfrxMemoView *> ((TObject *)frxReport1->Pages[0]->AllObjects->Items[idx]))
         {
           Memo->Top = 100;
         }
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.