 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Franco Jommi Guest
|
Posted: Sun Jan 25, 2004 3:08 pm Post subject: Implicit POST ? |
|
|
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
|
Posted: Mon Jan 26, 2004 3:44 am Post subject: Re: Implicit POST ? |
|
|
"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
|
Posted: Mon Jan 26, 2004 8:43 am Post subject: Re: Implicit POST ? |
|
|
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
|
Posted: Mon Jan 26, 2004 8:57 am Post subject: Re: Implicit POST ? |
|
|
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
|
Posted: Mon Jan 26, 2004 9:44 am Post subject: Re: Implicit POST ? |
|
|
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 |
|
 |
|
|
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
|
|