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