[Lazarus] The db-aware controls allow editing a readonly-dataset
Joost van der Sluis
joost at cnoc.nl
Fri Nov 28 17:16:58 CET 2008
Op donderdag 27-11-2008 om 22:37 uur [tijdzone +0100], schreef Michael
> On Thu, 27 Nov 2008, Joost van der Sluis wrote:
> > Hi all,
> > When a dataset is read-only, the db-aware controls allow editing. The
> > changes aren't send to the dataset, though. Which is very confusing for
> > the user.
> > I don't know how to fix it. I can change TDatalink.ReadOnly so that is
> > checks if the dataset is ReadOnly. But, for exmple, TDBEdit.Readonly
> > directly passes the result of TDatalink.Readonly. And I checked with
> > Delphi and there TDBEdit.Readonly is false, even if the TDataset is
> > readonly.
> That is because the readonly is the TCustomEdit.ReadOnly, no ?
> You can set a edit read-only, even if the field is read-write, so
> this is normal in my eyes.
But also the other way: set a field or an TCustomEdit to read/write, if
the dataset is read-only? (atm , this is possible, and I did check with
Delphi, there you can do this also)
> But if the TDataset is readonly then the edit should of course also
> give readonly=True.
Well, it doesn't. The same holds for Delphi. But in Delphi
TEdit.Readonly is false, but you can't change it's data.
> > Alternative is to check in TDBEdit.IsReadOnly and relatives...
> ? Please explain ?
That's a private function which is used internally. We could check here
if the TDataset is readonly...
Just look up the code, it's pretty straight-forward.
More information about the Lazarus