Reputation: 463
I want to load the content of of dbctrlgrid at runtime (from database). So I encountered several challenges:
Any code snipplet is welcome
Upvotes: 1
Views: 1761
Reputation: 47704
To add controls to a TDBCtrlGrid
you have to set the controls parent to the Panel
property of the TDBCtrlGrid
. The problem is that this property is protected. There are several ways to overcome this limitation. One is shown at Delphi About: Accessing protected members of a component
This is a common technique known to Delphi programmers as the 'protected hack'.
Upvotes: 0
Reputation: 9096
To answer 1)
You don't query the TDBCtrlGrid, you query the underlying dataset; if it .IsEmpty
the grid is empty.
When people start using data aware (grid) components they have the tendency to see that as the 'data container' that you can query and modify, but that is not the case. See it as a view on your underlying data with some built-in editors that modify that data. Then the 'same rules' apply to you as to these editors: update the underlying dataset.
Upvotes: 1