Michael Van Canneyt wrote
The same is true in tiOPF, when using mediators:
At least I get a compile time error (most of the times), not a runtime error. And with tiOPF there was only one location to fix.
With the code I played with last night (where the table columns changed), I had to fix/recreate the columns in the DBGrid component and in the ClientDataSet component. Maybe I'm doing something wrong - like I said, I have used RAD style development in years, but the DBGrid did not pick up the fields, field widths etc I set up in the ClientDataSet.
Playing around I set the DisplayName and DisplayWidth on the fields in the ClientDataset, but the DBGrid is only picking up the field DisplayName's, it is not adhering to the DisplayWidth settings. So that is why I had to right-click the DBGrid, Columns Editor... and Add the required fields there too, and then set the column widths on the DBGrid. So this is why I had two placed to fix when the underlying database table changed. How do I get the DBGrid to take note of the ClientDataset's DisplayWidth values? I have the same issue in Lazarus - DisplayWidth is ignored by the DBGrid.
ps:
Does Lazarus have a TClientDataset component? I don't see anything on the component palette.
I'm using Lazarus 1.9.0 r54792 FPC 3.0.2 x86_64-freebsd-gtk2
I normally use TClientDataset to get local changes with a undo
option in the UI. Or if the end-user wanted those changes, then
I simply call ApplyUpdates(). What is the equivalent in FPC/Lazarus?
In one case you must change the code, in the other, you use the
point-and-click paradigma of RAD to correct things...
The other problem I'm experiencing is that all these settings are done via point-and-click. If I delete a component, all those settings disappear and I have to revert my code changes with Git, or recreate all settings. At least with tiOPF (where I chose to use code), I can delete and recreate components with ease in the UI, but never loose my custom settings (code).
Business logic should never be in DB controls events, only in field/dataset
events.
I'll make sure - thanks.
The series "Large database applications in delphi".
The strategy described there is used in a set of applications in which
the main one has over 2000 forms.
Thanks Michael, I'll browse through that now.
Regards,
Graeme