Board index » delphi » Good way of displaying updated number of records?

Good way of displaying updated number of records?

Hi!
I'm displaying a table with TTable-TDatasource-TDBGrid and I have a TLabel
wich should display the amount of records shown in the grid. Now which event
is the right one for actualizing this label? I tried TTable.afterpost, but
this event is not the right one if I delete a record with STRG-Del in the
grid. Also TDatasource.OnStatechange is not working in every case. I think
this problem is one which has been solved already, so does anyone knows how?

Thanks in advance,

Andreas Seebeck
www.febe.com

 

Re:Good way of displaying updated number of records?


Quote
Andreas Seebeck wrote:

> Hi!
> I'm displaying a table with TTable-TDatasource-TDBGrid and I have a
> TLabel wich should display the amount of records shown in the grid.
> Now which event is the right one for actualizing this label?

Depends on after which action(s) you want a label update.
Guess that TDataSource's OnDataChange event is better suited.

HTH  ...  Andreas

Re:Good way of displaying updated number of records?


just want to show the actual amount of datasets...

regards, Andreas

Re:Good way of displaying updated number of records?


Quote
Andreas Seebeck wrote:

> just want to show the actual amount of datasets...

Maybe I don't see the point, but this works for me:

procedure Form1.DataSource1DataChange();
  Label1.Caption:= IntToStr(Table1.RecordCount);
end;

Andreas

Re:Good way of displaying updated number of records?


You're right! I don't know why I did not try ondatachange, probably I
missunderstood the helptext and thought it was not suitable.

Thank you very much!

Andreas Seebeck

Re:Good way of displaying updated number of records?


Andreas,

TDataSource.OnStateChange should work in most cases, but I think you
will have to handle deletions separately in the TTable.AfterDelete
event. There is no TDataSetState corresponding to delete.

--
Stephen Brown

Quote
Andreas Seebeck wrote in message <7esda3$a...@forums.borland.com>...
>Hi!
>I'm displaying a table with TTable-TDatasource-TDBGrid and I have a
TLabel
>wich should display the amount of records shown in the grid. Now
which event
>is the right one for actualizing this label? I tried

TTable.afterpost, but
Quote
>this event is not the right one if I delete a record with STRG-Del in
the
>grid. Also TDatasource.OnStatechange is not working in every case. I
think
>this problem is one which has been solved already, so does anyone
knows how?

>Thanks in advance,

>Andreas Seebeck
>www.febe.com

Other Threads