` Printed Icetips Article

Icetips Article



Par2: Determining a record has changed
2000-02-17 -- Dennis Evans
 
The WindowManager TakeCompleted method uses a routine called ChangeAction.
The routine compares the record buffer before the update method is called.
If there has been no change in the record the update method is not called,
if the record has changed the update method is called.

So, I would use the Update method, after the parent call.

if RetunValue = Level:Benign
  do you stuff
end

Any value other than benign indicates an update error.   The main point is
the update method is only called when the record buffer has changed.


To catch an OK press on a form and determine whether the record
was changed or not:

 From the ChangeAction routine,

CODE
  LOOP
    SELF.Response = RequestCancelled
    SETCURSOR(Cursor:Wait)
    UnChanged = SELF.Primary.Me.EqualBuffer(SELF.Saved)
    IF UnChanged
      Error = 0
    ELSE
      Error = SELF.Primary.Update(CHOOSE(SELF.HistoryKey))
    END

   This line tests the the buffer if the buffer has not changed the
EqualBuffer method will return a true value, the update method is not
called.    The buffer is stored in the PrimeUpdate method, some thing some
where is changing a value in the record buffer  if the update method is
being called.   I use this technique in a similar manner and works here,
even with the Ok pressed



Printed November 21, 2024, 11:30 am
This article has been viewed/printed 35201 times.