Board index » delphi » capture move from row to row in grid

capture move from row to row in grid

OK, I have two grids.  The current record of grid1 sets the
filter for grid2.  

Q: in grid1, when you move from record1 to record2, how can I capture
that move to refresh the filter for grid2?  What event is triggered
in either the grid or its table that will allow me to refresh the
filter for grid2?

Is this a simple override of the 'Next' method for grid1's table? or is
Next not implicitly called by changing the current record in a grid?

Much Appreciated!

 

Re:capture move from row to row in grid


Reposting article removed by rogue canceller.

OK, I have two grids.  The current record of grid1 sets the
filter for grid2.  

Q: in grid1, when you move from record1 to record2, how can I capture
that move to refresh the filter for grid2?  What event is triggered
in either the grid or its table that will allow me to refresh the
filter for grid2?

Is this a simple override of the 'Next' method for grid1's table? or is
Next not implicitly called by changing the current record in a grid?

Much Appreciated!

Re:capture move from row to row in grid


I did it once with the drawing methods.  When you draw the active cell, set
a bookmark for the current record, and if the bookmark hasn't changed, call
your OnRecordMove event.

I preferred to do it with visual stuff cause my OnRecordMove stuff dealt
with the visual interface; your way of using table properties would be more
appropriate if your OnRecordMove did stuff with your data.

If you wanted to do data stuff when the record moves, you may want to use
OnCalcFields and put in a dummy calculated field to make the event fire.

Allen Willson <awill...@holli.com> wrote in article
<R.3244B87C.4...@holli.com>...
...

Quote
> Q: in grid1, when you move from record1 to record2, how can I capture
> that move to refresh the filter for grid2?  What event is triggered
> in either the grid or its table that will allow me to refresh the
> filter for grid2?

...

Re:capture move from row to row in grid


Quote
Allen Willson <awill...@holli.com> writes:
> Reposting article removed by rogue canceller.

> OK, I have two grids.  The current record of grid1 sets the
> filter for grid2.  

> Q: in grid1, when you move from record1 to record2, how can I capture
> that move to refresh the filter for grid2?  What event is triggered
> in either the grid or its table that will allow me to refresh the
> filter for grid2?

> Is this a simple override of the 'Next' method for grid1's table? or is
> Next not implicitly called by changing the current record in a grid?

> Much Appreciated!

Allen:

I assume you have 2 tables and 2 different datasources for each grid.
OK? (If not OK, disregard the rest.)

In my opinion, I think this is a case of master-detail
relationship, actually a 1:M relation, in which every record
in the master table has many corresponding children records
in the detail table.

In this case, you have to make use of OnDataChange event handler
of the master table's datasource, and it goes something like this:

procedure TForm1.MasterTableDataChange(Sender: TObject; Field: TField);
begin
     with DetailTable do
        { I'll use a Pseudo Code for Delphi 1 & 2 }  
         CLEAR FILTER
         ADD FILTER <myFilter> TO DETAIL
         ACTIVATE FILTER <myFilter>          
     end;
end;

Good Luck!

Dante Galapon

Re:capture move from row to row in grid


Another way is to use the OnDataChange-event for datasource1!

Thomas Werner

Quote
> Allen Willson <awill...@holli.com> wrote in article
> <R.3244B87C.4...@holli.com>...
> ...
> > Q: in grid1, when you move from record1 to record2, how can I capture
> > that move to refresh the filter for grid2?  What event is triggered
> > in either the grid or its table that will allow me to refresh the
> > filter for grid2?
> ...

Other Threads