How to combine Shapes with MasterData on the fly?

edited May 2011 in FastReport 4.0
Hello,

I have a databand. I need to draw special complex shapes (consisting of other shapes as many rectangles and lines) next to each record.

So the report should be like this (I used underline insead of space because the editor trims spaces):


Shape 1_______________Record 1 Field 1
_____________________ Record 1 Field 2
______________________Record 1 Field 3


Shape 2_______________Record 2 Field 1
_____________________ Record 2 Field 2
______________________Record 2 Field 3


Shape 3_______________Record 3 Field 1
_____________________ Record 3 Field 2
______________________Record 3 Field 3

And so on. The problem is that the Shape is different depending on the field values e.g. width and height. So I need the draw every shape on by one for every record.

I would do it on the fly in Delphi code. Is it possible?

Comments

  • edited 2:57PM
    I attach small demo, maybe you'll find it usefull.
    Tricks - Memo2 is aligned baLeft to force it to close to Shape1.
    All the rest comes from one OnBeforePrint event:
    procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
    begin
      Shape1.Width  := <Line#> *  2 * fr1cm;
      Shape1.Height := <Line#> * 15;
      if <Line#> mod 3 = 0 
        then Shape1.Shape := skTriangle       
        else Shape1.Shape := skRoundRectangle;                     
    end;
    

    Mick
  • edited 2:57PM
    Hello,

    Thank you for the demo. Do you think I can do this is the OnBeforePrint of frxReport in Delphi Code too?
  • edited 2:57PM
    In Delphi code most of FR Objects are NOT seen and will not compile.
    Search through this forum for FindObject and see how others make use of this construction.
    I found such an example

    TfrxMemoView (frxReport1.FindObject ('Memo1')). LineSpacing: = 100;

    Mick
  • edited 2:57PM
    Thank you Mick, I will try it.
  • thomas whitethomas white Los Angeles
    edited 2:57PM
    Thanks too mick, i will try now.

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.