[Lazarus] How to avoid DBGrid showing new blank record

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Lazarus] How to avoid DBGrid showing new blank record

Free Pascal - Lazarus mailing list
Hi.
I'm using Lazarus 1.6.4 and FPC 3.0.2, combined with a Firebird
database. I've added all the fields of a table and use a datadictionary.
I show the data in de DBGrid and use a seperate form to manipulate the
data and to insert a new record.
When inserting a new record, the DBGrid expands with a blank record. I
don't like that, I wish the DBGrid to show only the valid records and a
new record is not a valid record yet.
1. I've tried this with a query 'select * from dataset where number is
not null'. This doesn't work.
2. I've tried this with dataset.Disablecontrols (and enablecontrols),
this doesn't work either.
3. I've activated the option dgDisableInsert, that doesn't work either.
The only solution I found is to use in the DBGrid a seperate view I
created in the database. It works, but I keep wondering if there is an
other solution possible.

--
mvg
Frans van Leeuwen
M 06-51695390


---
Deze e-mail is gecontroleerd op virussen door AVG.
http://www.avg.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Lazarus] How to avoid DBGrid showing new blank record

Free Pascal - Lazarus mailing list


On Thu, 1 Jun 2017, frans via Lazarus wrote:

> Hi.
> I'm using Lazarus 1.6.4 and FPC 3.0.2, combined with a Firebird
> database. I've added all the fields of a table and use a datadictionary.
> I show the data in de DBGrid and use a seperate form to manipulate the
> data and to insert a new record.
> When inserting a new record, the DBGrid expands with a blank record. I
> don't like that, I wish the DBGrid to show only the valid records and a
> new record is not a valid record yet.
> 1. I've tried this with a query 'select * from dataset where number is
> not null'. This doesn't work.
> 2. I've tried this with dataset.Disablecontrols (and enablecontrols),
> this doesn't work either.
> 3. I've activated the option dgDisableInsert, that doesn't work either.
> The only solution I found is to use in the DBGrid a seperate view I
> created in the database. It works, but I keep wondering if there is an
> other solution possible.

I don't think so.

The grid shows what is in the dataset. An inserted record is in the dataset.
One possible way to do this is to collect all data for the new record in a
not-data-aware manner, and only insert when it is complete.

Michael.
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Loading...