| Dan Pressnell 2006-12-13, 6:55 pm |
| There is what I think a bug in the windowmanager code when the user is
inserting an auto-incremented record and decides to cancel after adding
child/related records.
After getting the message that there are child records and the parent record
cannot be deleted, the fields for the parent record appear to blanked in the
window. This is because during the process of relation checking, the parent
record is again retrieved from the table, wiping out what the user has
typed.
This happens in both C55 and C6. Below are the modifications that can be
made to the windowmanager class to correct it. The additions are the lines
that have the "added by dp" comment.
=============
WindowManager.TakeCloseEvent PROCEDURE
us ushort ! added by dp
CODE
IF SELF.Response <> RequestCompleted AND ~SELF.Primary &= NULL
IF SELF.CancelAction <> Cancel:Cancel AND ( SELF.Request = InsertRecord
OR SELF.Request = ChangeRecord )
IF ~SELF.Primary.Me.EqualBuffer(SELF.Saved)
IF BAND(SELF.CancelAction,Cancel:Save)
IF BAND(SELF.CancelAction,Cancel:Query)
CASE
SELF.Errors. Message(Msg:SaveRecord,Button:Yes+Button
:No+Button:Cancel,Button:Cancel)
OF Button:Yes
POST(Event:Accepted,SELF.OKControl)
RETURN Level:Notify
OF BUTTON:Cancel
SELECT(SELF.FirstField)
RETURN Level:Notify
END
ELSE
POST(Event:Accepted,SELF.OKControl)
RETURN Level:Notify
END
ELSE
IF SELF.Errors.Throw(Msg:ConfirmCancel) = Level:Cancel
SELECT(SELF.FirstField)
RETURN Level:Notify
END
END
END
END
IF SELF.OriginalRequest = InsertRecord AND SELF.Response =
RequestCancelled
us = self.primary.me.savefile() ! added by dp
IF SELF.Primary.CancelAutoInc() THEN
self.primary.me.restorefile(us) ! added by dp
SELECT(SELF.FirstField)
RETURN Level:Notify
END
self.primary.me.restorefile(us) ! added by dp
END
IF SELF.LastInsertedPosition
SELF.Response = RequestCompleted
SELF.Primary.Me.TryReget(SELF.LastInsertedPosition)
END
END
RETURN Level:Benign
===========
|