Re: TZF - Auto Increment

Marie Vihonsky <[email protected]>
Newsgroups gmane.comp.lang.delphi.topaz
Message-ID <[email protected]>
Hi Joe,

Try using the BeforePost event and checking if the DataSource is in 
Insert or Edit state (DataSource.State). I usually don't let the user 
add a record while in a grid.  I also don't like the cryptic buttons in 
the Navigator and usually hide the 'add,edit,delete,post,refresh' 
buttons and instead make my own buttons on the form, then I can control 
stuff better.

Marie

joseph.edwards wrote:
> HI everyone.
> 
> Having struggled for another three hours to try and get an auto-increment on
> a field working,  can anyone help me perhaps with some demo code?
> 
> I can get it to work using the OnNewRecord and AfterInsert events,  but I
> cannot deal with the situationn where the user cancels after choosing an
> append.
> 
> In dBASE,  I have control over exactly when I append the record and by using
> a matching set of memory variables I can update the autoincrement counter
> only when I actually append a new record.
> 
> However if I use tzNavigator,  and get the new incremented field value with
> the OnNewRecord event ,  when do I update this valuefor the next time?  If
> you use AfterInsert this does not work as this triggers before the record is
> cancelled.  I cannot use after Post as this would fire when any record not
> just a new one was posted.  Similarly AfterCancel is no help either.
> Perhaps I have to keep a system flag to tell me when I am inserting a new
> record but this is getting very kludgy?
> 
> Does anyone have any good ideas.
> 
> Thanks in advance
> 
> Joe

==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5kvff.Z2NsZHQt
Or send an email to: [email protected]

TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
==^================================================================
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.