Board index » delphi » D2/DBGrids: strange behavior (blank posts)

D2/DBGrids: strange behavior (blank posts)


I'm having a very strange problem: I use several TSpeedButtons to
simulate a vertical TDBNavigator, to control several MDI child forms,
each of them with a TDBGrid linked to a specific table. The tables
have two fields (code and description) and the code field (which is
the key) is automatically generated for each record.

Now the problem: If I use a TDBNavigator everything runs ok but, if I
use my speed buttons the description field (which is the editable one)
won't post the text written on it, except if I press ENTER before
pressing the Post speed button. Odd, isn't it?

Has anyone experienced something similar to this?

Thanks in advance.

Nuno Leal



Re:D2/DBGrids: strange behavior (blank posts)

New info on this.

It really doesn't matter the organisation I have. The key points are a
routine that generates a new value for the key field (named Code) and
posts the record to the table, and a OnBeforePost event.

I press the 'Insert' speed button and the grid accepts the Description
column value (text). Now, if I press  the RETURN key before pressing
the 'Post' speed button (that calls the generate and post routine),
the record is correctly posted but, if I don't press RETURN, the
Description field will be posted blank, regardless of any text it may
had. This is really driving me nuts!

I placed a MessageBox to verify the value of DataSet['Description']
and have done a few tests and I found that if I assign the Code field
value (DataSet['Code']) inside the OnBeforePost event it works
perfectly, but if I do it inside my generate and post routine, the
Description value gets lost! Amazing...

Can anyone please suggest something?


Nuno Leal


Other Threads