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 

Implicit POST ?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc
View previous topic :: View next topic  
Author Message
Franco Jommi
Guest





PostPosted: Sun Jan 25, 2004 3:08 pm    Post subject: Implicit POST ? Reply with quote



I have a BeforePost routine that performs a few cheks before accepting the
data typed by the user in a DBGrid appended row. If the checks are passed,
my routine ends with a specific POST statement to consolidate the data (just
before the post, the BeforePost event is deactivated to avoid an infinite
loop, and then reactivated).
I have a <Write> button to end the changes the user wants to make, but I
used a BeforePost event to cater for the situation where the user fills the
data and then moves the cursor to another row, ignoring the button.
I knew that moving the cursor of a table form one row to another (say in a
DBGrid) while in edit mode is just like making a POST, but I found that in
this case, my routine writes twice the same record.
Did you know this ?


Back to top
pr
Guest





PostPosted: Mon Jan 26, 2004 3:44 am    Post subject: Re: Implicit POST ? Reply with quote




"Franco Jommi" <franco.jommmi (AT) tin (DOT) it> wrote

Quote:
I have a BeforePost routine that performs a few cheks before accepting the
data typed by the user in a DBGrid appended row. If the checks are passed,
my routine ends with a specific POST statement to consolidate the data
(just
before the post, the BeforePost event is deactivated to avoid an infinite
loop, and then reactivated).
I have a <Write> button to end the changes the user wants to make, but I
used a BeforePost event to cater for the situation where the user fills
the
data and then moves the cursor to another row, ignoring the button.
I knew that moving the cursor of a table form one row to another (say in a
DBGrid) while in edit mode is just like making a POST, but I found that in
this case, my routine writes twice the same record.
Did you know this ?

Why so complicated? Check the values as you do now.
If one is not acceptable then execute the the silent
exception SysUtils.Abort in the BeforePost event.

PR







Back to top
Jeremy Collins
Guest





PostPosted: Mon Jan 26, 2004 8:43 am    Post subject: Re: Implicit POST ? Reply with quote



Franco Jommi wrote:
Quote:
I have a BeforePost routine that performs a few cheks before accepting the
data typed by the user in a DBGrid appended row. If the checks are passed,
my routine ends with a specific POST statement to consolidate the data (just
before the post, the BeforePost event is deactivated to avoid an infinite
loop, and then reactivated).
I have a <Write> button to end the changes the user wants to make, but I
used a BeforePost event to cater for the situation where the user fills the
data and then moves the cursor to another row, ignoring the button.
I knew that moving the cursor of a table form one row to another (say in a
DBGrid) while in edit mode is just like making a POST, but I found that in
this case, my routine writes twice the same record.
Did you know this ?

Yes - it is documented. You don't need to call Post at all, the idea is that
BeforePost allows you to *cancel* a post, normally by raising an exception.

Commonly, people call Sysutils.Abort - the silent exception.


--
jc

Remove the -not from email

Back to top
Franco Jommi
Guest





PostPosted: Mon Jan 26, 2004 8:57 am    Post subject: Re: Implicit POST ? Reply with quote

This is interesting and might be the solution to my problem. But what is it
a "silent exception" ? Can you give an example on how to call this exception
? Thanks

"Jeremy Collins" <jd.collins (AT) ntlworld-not (DOT) com> ha scritto nel messaggio
news:Aq4Rb.10990$JL4.90049 (AT) newsfep4-glfd (DOT) server.ntli.net...
Quote:
Franco Jommi wrote:
I have a BeforePost routine that performs a few cheks before accepting
the
data typed by the user in a DBGrid appended row. If the checks are
passed,
my routine ends with a specific POST statement to consolidate the data
(just
before the post, the BeforePost event is deactivated to avoid an
infinite
loop, and then reactivated).
I have a <Write> button to end the changes the user wants to make, but I
used a BeforePost event to cater for the situation where the user fills
the
data and then moves the cursor to another row, ignoring the button.
I knew that moving the cursor of a table form one row to another (say in
a
DBGrid) while in edit mode is just like making a POST, but I found that
in
this case, my routine writes twice the same record.
Did you know this ?

Yes - it is documented. You don't need to call Post at all, the idea is
that
BeforePost allows you to *cancel* a post, normally by raising an
exception.

Commonly, people call Sysutils.Abort - the silent exception.


--
jc

Remove the -not from email



Back to top
Jeremy Collins
Guest





PostPosted: Mon Jan 26, 2004 9:44 am    Post subject: Re: Implicit POST ? Reply with quote

Franco Jommi wrote:

Quote:
This is interesting and might be the solution to my problem. But what is it
a "silent exception" ? Can you give an example on how to call this exception

As I said, it is documented. Here is an exmaple of raising a
silent exception:

begin
Abort;
end;

HTH

--
jc

Remove the -not from email

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc 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.