DBCrossView and interactive report

Hello,

I want to make interactive report with DBCrossView object. I want to make something in my app after user have clicked in the crossview cell on the report preview. I have found DblClickOnPreview event but I don't know how in this event to get information which cell was clicked. Is it possible?

--
best regards
Adam Siwon

Comments

  • gpigpi
    edited 9:59AM
    Try to use:
    procedure Cross1OnPrintCell(Memo: TfrxMemoView; RowIndex, ColumnIndex, CellIndex: Integer; RowValues, ColumnValues, Value: Variant);
    begin
         Memo.TagStr := IntToStr(RowIndex) + '|' + IntToStr(ColumnIndex);                                                      
    end;
    
    procedure Cross1Cell0OnPreviewClick(Sender: TfrxView; Button: TMouseButton; Shift: Integer; var Modified: Boolean);
    begin
         ShowMessage(TfrxMemoView(Sender).TagStr);                              
    end;
    
  • edited 9:59AM

    Yes it works, but I have another problem. Now I know what is number of the column or row of DBCrossView. How I can get field value from particular columns or rows? Is it a simple way or I should to store these values in the OnPrintColumnHeader event?

    --
    best regards
    Adam Siwoń
  • edited 9:59AM
    Try to put this vaule in a TagStr of each cell as Gpi showed by building a bit more complicated string concatenations.

    Mick
  • edited May 2011
    Mick.pl wrote: »
    Try to put this vaule in a TagStr of each cell as Gpi showed by building a bit more complicated string concatenations.

    I have tried to set TagStr using DataSet.FieldByName('column_id').AsString in OnPrintCell event, but for every cell I have the same value of the field. I think the only way is save to string lists the values of columns and rows in OnPrintColumnHeader event and OnPrintRowHeader event and then prepare Memo.TagStr for every cell. I will try to do this tomorrow. Thank you for your help.

    --
    best regards
    Adam Siwon
  • edited 9:59AM
    Noone knows well how DBCross manipulate its data & cells (if you don't search through FR source code).
    But you can use offical methods to work with data that DBCross passes to each cell in OnPrintCell event.
    Pay attention how to get data value passed to this event - I mean Value parameter.
    procedure Cross1OnPrintCell(Memo: TfrxMemoView; RowIndex, ColumnIndex, CellIndex: Integer; 
                                RowValues, ColumnValues, Value: Variant);
    begin
      Memo.TagStr := IntToStr(RowIndex) + '|' + IntToStr(ColumnIndex) + '|' + VarToStr(Value);;  
    end;
    

    OnPrintColumnHeader is not fired for each cell, so you won't be able to use it for gathering data you need.

    Mick
  • edited May 2011
    Mick.pl wrote: »
    Noone knows well how DBCross manipulate its data & cells (if you don't search through FR source code).
    But you can use offical methods to work with data that DBCross passes to each cell in OnPrintCell event.
    Pay attention how to get data value passed to this event - I mean Value parameter.

    Yes I saw this when I made test. I can't get values from the dataset also in the OnPrintColumnHeader event.
    Mick.pl wrote: »
    OnPrintColumnHeader is not fired for each cell, so you won't be able to use it for gathering data you need.

    The main problem is, that I don't need to have value from the cell which was clicked. The most valuable information is database identities of row and column for clicked cell.

    Today I solved this problem. In the OnPrintCell event I'm reading column and row header values in the following way:
      Memo.TagStr := VarToStr(RowValues[0]) + ';' + VarToStr(ColumnValues[0]);
    

    And then in the DBCross1Cell0OnPreviewDblClick I can read from these values from TagStr property and find appropriate identity value for row and column in the source DataSet.

    Thank you very much for help.

    --
    best regards
    Adam
  • edited 9:59AM
    I still wonder how to force "codebox" & "/codebox" to show only lines that are needed instead of adding many empty lines like below:
    Memo.TagStr := VarToStr(RowValues[0]) + ';' + VarToStr(ColumnValues[0]);
    

    Can you give me any suggestion on that?

    Mick

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.