Felipe Monteiro de Carvalho wrote:

Luiz Americo wrote:

This is the way TDataset works. If a record is not posted then it can be cancelled (maybe DBGrid is calling cancel in this case).
A simple way to add a record is to do a procedure like:

 ASlite.Append;
ASqlite.Post;

and associate with a button OnClick event.

Be aware that data will not be saved to database. If you want this then call ApplyUpdates (see conditions in wiki to ApplyUpdates work) or set SaveOnClose to true.


I'd like the new record to be posted by default when I change to another record instead of being canceled. Is putting Post on the events the best way to go? It seams a little ugly to add OnClick just for that. And then I will also need OnKeyDown for the keyboard...

Now i understand what you're saying: is the dbgrid feature that allows you to add a new record when pressing down in the last record. It seems a bug (or the correct behavior?) of TDBGrid. Adding ASqlite.Post to AfterInsert event would do what you want but has a drawback: pressing down will add a lot of empty records. The correct approach is to modify TDBGrid to detect when a change has been made to the record and then Post it. You can add a bug to bugtracker.


Active:=True; ?

I see no such property on TSqliteDataset. It does exist on TDbf, however. Maybe it should be added??

Right now i'm seeing it in the object inspector: is the first property. Using Lazarus svn + fpc 2.0.0 + WindowsXP



BTW: Are you brazilian?


Yes =)

Me too. If you want you can contact me in portuguese

Luiz

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to