Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread TDataSet / TGrid: Filter and Display
Mon, Jul 29 2013 9:37 AMPermanent Link

Christian Kaufmann

I run into a general problem with TDataSet / TGrid; one of the reasons
I don't use TDataSet anymore in Delphi. I try to keep it short:

I have an entry system. On a first screen you can add / edit / delete
your athletes. For this I use a dataset and a grid.

On a second screen, you make team entries. Either for a women or a men
team. Depending on the selection, I want to filter for men or for
women only. In a popup I use a grid again to select the athlete.

So either I use two datasets for the athletes: One for athlete edit
and one for the selection in the team entry. Disadvantage here is,
that I load the same items twice.

Or I use one dataset in two different TGrid's. In this case I have to
be carefull to set filter correctly, depending on which grid is active
and visible.

Personally I think it is bad to have filtering on the TDataSet level.
It should be in TGrid. Same is true for OnGetText/OnSetText. At least
for display formating, there should be a way to do it in the TGrid.
The display problem can be solved with calculated fields in Delphi,
but even then you have your code to format the display not near the
TGrid but in the datamodule with the TDataSet.

In Delphi I use a VirtualTree subclass for all my grids and then I
create an additional object/class for each row (or TreeNode). In
general, this node class is responsable for display.

Now I know, EWB is close to the usual Delphi way. But I would like to
see an abstract TGrid, that works independent of a TDataSet and where
you have events to read/write data.

Or what are other approaches to this problem?

cu Christian
Mon, Jul 29 2013 2:35 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Christian,

<< Now I know, EWB is close to the usual Delphi way. But I would like to see
an abstract TGrid, that works independent of a TDataSet and where you have
events to read/write data. >>

You can use the TGrid in an un-bound manner (MyGrid.DataSet:=nil).  You just
have to handle all of the population, etc. yourself.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jul 30 2013 10:41 AMPermanent Link

Christian Kaufmann

>You can use the TGrid in an un-bound manner (MyGrid.DataSet:=nil).  You just
>have to handle all of the population, etc. yourself.

Just by using AppendRow() and the Cell[] property?

What about events when the user edits a cell? Where do I update my
business object with new data entered in the TGrid?

And what about marking single cells with different colors and styles
(e.g. negative values in red)?

cu Christian
Wed, Jul 31 2013 1:10 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Christian,

<< Just by using AppendRow() and the Cell[] property? >>

Correct.

<< What about events when the user edits a cell? Where do I update my
business object with new data entered in the TGrid? >>

There aren't any events for that as of yet.  I'll have to see about adding
them.

<< And what about marking single cells with different colors and styles
(e.g. negative values in red)? >>

No possible yet, either.

Tim Young
Elevate Software
www.elevatesoft.com
Image