Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-11

The db-aware controls allow editing a readonly-dataset

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Joost van der Sluis

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.

Alternative is to check in TDBEdit.IsReadOnly and relatives...

Any ideas what's the best approach?

Joost.

Reply by email

Michael Van Canneyt
to Joost van der Sluis
Joost van der Sluis wrote 11 lines
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 if the TDataset is readonly then the edit should of course also give readonly=True.

Alternative is to check in TDBEdit.IsReadOnly and relatives...

? Please explain ?

Michael.

Reply by email

Joost van der Sluis
to Michael Van Canneyt

Op donderdag 27-11-2008 om 22:37 uur [tijdzone +0100], schreef Michael Van Canneyt:

Show quoted text 19 lines
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.

Joost.

Reply by email