TfrxCrossView Align baCenter issue

edited 5:29AM in FastReport 4.0
Hi,
I've checked the forums and documentation for any special steps regarding the alignment of a TfrxCrossView component which is filled with data during runtime.

When I set the Align property to baCenter it aligns the component based on the original width prior to it being populated with data. The attached docs displays the behaviour I am experiencing. I can understand why it's happening but need to 'refresh' the alignment after the data has been added.

I have tried setting the Align property on various events within the Script e.g. Cross1OnAfterPrint(), Cross1OnBeforePrint(), Cross1OnCalcWidth(), Cross1OnAfterData()
I have also tried setting the property on the 2nd pass within my code e.g. frxReport1BeforePrint() -> IsFinalPass()

Thanks in advance for your help

Comments

  • edited 5:29AM
    I can't force DBCross to be aligned the way you wish, but I tried with succes to change its Left position.
    Have a look at the code below and if you find it interesting then follow the idea I tested.
    var DBCrossWidth :real;
        LastCol :int;                                                               
    
    procedure DBCross3OnCalcWidth(ColumnIndex: Integer; ColumnValues: Variant; var Width: Extended);
    begin
       if ColumnIndex > LastCol 
         then begin
                DBCrossWidth := DBCrossWidth + Width;
                LastCol := ColumnIndex;
              end
         else DbCross3.Left := MasterData1.Width - DBCrossWidth/2;
    end;
    
    begin
       LastCol := 0;                            
    end.
    

    Mick
  • edited 5:29AM
    Mick,
    Thanks for the suggestion, however it appears that the Width parameter of Cross1OnCalcWidth() is based on a width value before the cols are autosized. When I tested your suggestion the Width value was always 200 which I know is not the true width as the column widths are all different i.e. autosize.

    One thing I must emphasize is that I am using the CrossView component (not DBCrossView) and populating the values within frxReport1BeforePrint in my own code. Could it be possible to calculate the Left position after a IsFinalPass() check within the frxReport1BeforePrint function i.e. once the data has already been added.

    Any other suggestions greatly appreciated.

    D'Arcy
  • edited 5:29AM
    Hi,
    Did anyone get a chance to consider my reply. Unfortunately this is still an issue.

    Kind regards,
    D'Arcy

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.