customisd dbgrid

I need to respond to a change of state in the datasource attached to my customised dbgrid. Its to make sure my inline editor is hidden when any edits are posted programmatically so I need a generic solution built into the grid rather than one for a specific instance.

The only way I've been able to think of myself is to override the datasources OnStateChange event, replacing it with my own and calling any user assigned one as part of my replacement code.

I'm not very happy with this because I think it will cause problems somewhere else at some point.

Anyone have a good way to accomplish this?

Roy Lambert
0
Roy
7/1/2014 7:24:25 AM
public.delphi.vcl.writing 510 articles. 0 followers. Follow

2 Replies
482 Views

Similar Articles

[PageSpeed] 22

Roy Lambert wrote:

> I need to respond to a change of state in the datasource attached to
> my customised dbgrid. Its to make sure my inline editor is hidden
> when any edits are posted programmatically so I need a generic
> solution built into the grid rather than one for a specific instance.
> 
> The only way I've been able to think of myself is to override the
> datasources OnStateChange event, replacing it with my own and calling
> any user assigned one as part of my replacement code.
> 
> I'm not very happy with this because I think it will cause problems
> somewhere else at some point.

Definitely.

> Anyone have a good way to accomplish this?

Override the grid's CreateDatalink method and create and return a
custom descendent of TGridDatalink. In that descendent you can override
some of the virtual methods the link class has to react to changes in
the dataset the grid is attached to.



-- 
Peter Below (TeamB)
0
Peter
7/1/2014 4:48:38 PM
Peter


>Override the grid's CreateDatalink method and create and return a
>custom descendent of TGridDatalink. In that descendent you can override
>some of the virtual methods the link class has to react to changes in
>the dataset the grid is attached to.

I don't know why but I assumed that the datalink would just be created in the grids constructor. Never even thought there would be a separate method for this. Thanks as always.

Roy Lambert
0
Roy
7/2/2014 7:35:19 AM
Reply: