Board index » delphi » Delphi 1.x - TTable.Modified BUG? HELP!!!!

Delphi 1.x - TTable.Modified BUG? HELP!!!!

Hey Delphites!!

I seem to be having a strange problem with the Modified property
of a standard ttable.

I have a form with some DBcontrols, a couple of radio buttons
to move between associated records, and cancel and save buttons
to exit the dialog.  Both buttons and the radio events all
use Ttable.modified to determine whether to prompt or not
to save changes.  The radio buttons work fine, but both the
button press routines see the Modified property as false
after a field has been modified (it definitely was modified
because I tried posting if "modified" was false, and the record
changed!!).

HAS ANYONE seen this happen ? It really makes no sense!

Thanks in Advance...

Frank

 

Re:Delphi 1.x - TTable.Modified BUG? HELP!!!!


Hey Delphites!!

I seem to be having a strange problem with the Modified property
of a standard ttable.

I have a form with some DBcontrols, a couple of radio buttons
to move between associated records, and cancel and save buttons
to exit the dialog.  Both buttons and the radio events all
use Ttable.modified to determine whether to prompt or not
to save changes.  The radio buttons work fine, but both the
button press routines see the Modified property as false
after a field has been modified (it definitely was modified
because I tried posting if "modified" was false, and the record
changed!!).

HAS ANYONE seen this happen ? It really makes no sense!

Thanks in Advance...

Frank

Re:Delphi 1.x - TTable.Modified BUG? HELP!!!!


Hey Delphites!!

I seem to be having a strange problem with the Modified property
of a standard ttable.

I have a form with some DBcontrols, a couple of radio buttons
to move between associated records, and cancel and save buttons
to exit the dialog.  Both buttons and the radio events all
use Ttable.modified to determine whether to prompt or not
to save changes.  The radio buttons work fine, but both the
button press routines see the Modified property as false
after a field has been modified (it definitely was modified
because I tried posting if "modified" was false, and the record
changed!!).

HAS ANYONE seen this happen ? It really makes no sense!

Thanks in Advance...

Frank

Re:Delphi 1.x - TTable.Modified BUG? HELP!!!!


In article <4ofh2t$...@comet2.magicnet.net>,

Quote
Frank Postava <sim...@magicnet.net> wrote:
>Hey Delphites!!

>I seem to be having a strange problem with the Modified property
>of a standard ttable.

Yes, I have been struggling with this, too. Result: Give it up and
try a different approach. What I'm doing now is to check for the
states of all the tables in the form (use the DataSet-property of
the DataSource(s) on the form if your DataSets are on another
form).
That is, I have code like this attached to the OnClose event of
the form:

AskForConfirm := false;

{ check if any table was modified and then try post for all of
    them}
while not AskForConfirm do
begin
    with DataSource1.DataSet as TTable do
    if State in [dsEdit, dsInsert] then
    begin
        AskForConfirm := true;
        Break;
    end;

    with DataSource2.DataSet as TTable do
    ...
    ...

    Exit;   { jump out of loop after the execution when }
            { none of the tables was modified }
end; { while }

if AskForConfirm then
    ... { ask for confirmation of changes and post or cancel}
        { for all tables }
    { Important: Check again whether the table is in Edit-mode }
    { before posting, otherwise the user will get an annoying }
    { message. }

Hope this helps, bye, mq

---------------------------------------------------------------
Markus Quandt                  a2137...@athena.rrz.uni-koeln.de
Cologne, Germany
---------------------------------------------------------------

Other Threads