Sign in Join

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

Mailing lists / lazarus / 2010-07

TDbGrid almost read-only ? :-)

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Bogusław Brandys

Hi

I'd like to set TDBGrid when almost all columns except first are read- only. So far so good - I have set them to read only and first column which is boolean type has nice checkboxes. I have two little problems yet : when scrolling with down arrow DBGrid tries to add empty row in the end of table , and also when somebody press Ctrl+Delete he can delete a record from dataset (I have TDBGrid connected to the TSQLQUery result).

How to prevent those two little issues ?

Boguslaw

Reply by email

Frank Church
to Bogusław Brandys

2010/7/13 Bogus?aw Brandys

Show quoted text 12 lines
Hi I'd like to set TDBGrid when almost all columns except first are read- only. So far so good - I have set them to read only and first column which is boolean type has nice checkboxes. I have two little problems yet : when scrolling with down arrow DBGrid tries to add empty row in the end of table , and also when somebody press Ctrl+Delete he can delete a record from dataset (I have TDBGrid connected to the TSQLQUery result). How to prevent those two little issues ?

Check the Options property for those settings

Boguslaw

Show quoted text 7 lines
-- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100713/7f292b40/attachment.html>

Reply by email

Bogusław Brandys
to Frank Church

Frank Church pisze:

Show quoted text 37 lines
2010/7/13 Bogus?aw Brandys < <mailto:>> Hi I'd like to set TDBGrid when almost all columns except first are read- only. So far so good - I have set them to read only and first column which is boolean type has nice checkboxes. I have two little problems yet : when scrolling with down arrow DBGrid tries to add empty row in the end of table , and also when somebody press Ctrl+Delete he can delete a record from dataset (I have TDBGrid connected to the TSQLQUery result). How to prevent those two little issues ? Check the Options property for those settings Boguslaw -- _______________________________________________ Lazarus mailing list <mailto:> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- Frank Church ======================= http://devblog.brahmancreations.com

Solutions were given to me by a user from IRC channel : to prevent Ctrl+Delete it's needed to place Abort into OnBeforeDelete of TSQlQuery and set dbgrid option dgConfirmDelete to false. To prevent adding new record it is needed to put DataSet.Cancel in OnNewRecord event of assocciated tSQlQuery.

Thank you very much.

Boguslaw

Reply by email

Luca Olivetti
to Bogusław Brandys

En/na Bogus?aw Brandys ha escrit:

Show quoted text 5 lines
Solutions were given to me by a user from IRC channel : to prevent Ctrl+Delete it's needed to place Abort into OnBeforeDelete of TSQlQuery and set dbgrid option dgConfirmDelete to false. To prevent adding new record it is needed to put DataSet.Cancel in OnNewRecord event of assocciated tSQlQuery.

Or use a TRxDbGrid and remove from AllowedOperations aoInsert, aoAppend and aoDelete.

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 (Ext.133) Fax +34 93 5883007

Reply by email