Moving Report Components
I want to be able to show or hide various parts of a report, depending on some criteria a user selects. I know how to reference report objects and make them visible or invisible, but when a non-visible component is hidden it still seems to occupy space in the generated report.
For example, say I have a report with three memo fields: mmoOne, mmoTwo and mmoThree. If I hide mmoTwo I would expect mmoThree to appear immediately under mmoOne in the generated report. However, what happens is that mmoThree stays where it is and, although the contents of mmoTwo are not visible, the space it occupies is.
Is there a way for visible report components to automatically move to the space occupied by a component that has been set to Visible = False? Is there a property I need to set?
Sorry if I haven't explained that clearly. [img]style_emoticons/<#EMO_DIR#>/blink.gif" style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" /> Thanks. Regards, Steve[/img]
For example, say I have a report with three memo fields: mmoOne, mmoTwo and mmoThree. If I hide mmoTwo I would expect mmoThree to appear immediately under mmoOne in the generated report. However, what happens is that mmoThree stays where it is and, although the contents of mmoTwo are not visible, the space it occupies is.
Is there a way for visible report components to automatically move to the space occupied by a component that has been set to Visible = False? Is there a property I need to set?
Sorry if I haven't explained that clearly. [img]style_emoticons/<#EMO_DIR#>/blink.gif" style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" /> Thanks. Regards, Steve[/img]
Comments
However, I'm doing mostly by code (I assume it has same effect as if done with the desginer), before calling .PrepareReport or .show
At which point are you doing it? In which event?
I think I also change some visibility on OnBeforePrint event of a page (because that happens before the same event of each band), try that if not doing it yet.
the report engine processes from top down by band type and left to right in the band in order
the objects were created, you therefore cannot modify an object which has been
handled already(output), from events of an object which follows it.
Great care should be taken when modify object, design props, you can widow an object to the page from its band.
Look at the user manual script chapter on using the engine object to modify output positions.
curx cury.
you can also have memos that contain multiple datafields on each line
and write code to stip white space
procedure mLabelOnAfterData(Sender: TfrxComponent);
var i: integer;
begin
for i := TfrxMemoView(Sender).Lines.Count - 1 downto 0 do
begin
if TfrxMemoView(Sender).Lines.Strings = '' then
TfrxMemoView(Sender).Memo.Delete(i);
end;
end;