BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DataSource.AutoEdit with Data aware controls problem

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Thu Feb 01, 2007 3:28 pm    Post subject: DataSource.AutoEdit with Data aware controls problem Reply with quote



I have a form with several data aware controls connected to a
datasource.
I want the user to be able to edit the values in the controls but
these values will no be written to the database
before they click on a Tbutton which will make the Commit/update to
the DB.
If I set the Datasource's AutoEdit Property is set to false then the
user cannot change the values of the controls at all.
Is there any way to do such a thing?
Back to top
GuidoSkynet
Guest





PostPosted: Sun Apr 29, 2007 7:27 pm    Post subject: Re: DataSource.AutoEdit with Data aware controls problem Reply with quote



<tzvikaz (AT) gmail (DOT) com> wrote:
Quote:
I want the user to be able to edit the values in the controls but
these values will no be written to the database
before they click on a Tbutton which will make the Commit/update to
the DB.
If I set the Datasource's AutoEdit Property is set to false then the
user cannot change the values of the controls at all.
Is there any way to do such a thing?

When the user is allowed to change a record, enable / disable a few TButtons
with captions such as: "Edit", "Save" and "do NOT save".
btnEdit.Enabled := True;
btnPost.Enabled := False;
btnCancel.Enabled := False;

When the user clicks btnEdit, set the table in "edit" state:
Table1.Edit;
btnPost.Enabled := True;
btnCancel.Enabled := True;
btnEdit.Enabled := False;

When btnPost is clicked:
Table1.Post; // data is saved
btnEdit.Enabled := True;
btnPost.Enabled := False;
btnCancel.Enabled := False;

When btnCancel is clicked:
Table1.Cancel; // data is not saved
btnEdit.Enabled := True;
btnPost.Enabled := False;
btnCancel.Enabled := False;

Good luck!
Guido, DelphiLand Team
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.