Search code examples
delphireportfastreport

how to hide all values of a column on event OnPreviewClick using fastReport


I'm trying hide values when I do a click on one of values of a row. But not all values just the column which I clicked.

See down Image of Demonstration

enter image description here

I want when I do a click on 12, change all values of the column for 0 ou null and when a click again the values come back a original.


Solution

  • You can add OnPreviewClick event to the field you want to hide do like this:

    procedure frxDBDataset1Field1OnPreviewClick(Sender: TfrxView; Button: TMouseButton; Shift: Integer; var Modified: Boolean);
    begin
       if frxDBDataset1Field1.text = '' then
         frxDBDataset1Field1.text := '[frxDBDataset1."Field1"]'
       else  
         frxDBDataset1Field1.text := '';
       Report.ShowReport;  //this will refresh the report                                                                            
    end;
    

    Every time you click any value of the column it will hide/show.