` Printed Icetips Article

Icetips Article



Par2: EIP required fields and lose focus event
2001-11-26 -- Dennis Evans
 
> !In TakeEvent for First field, after parent call
> UPDATE(SELF.Feq)
> IF ReturnValue AND ReturnValue ~= EditAction:Cancel
>     IF ~BRW1.Q.MYF:FirstField
>         ReturnValue = EditAction:None
>     ELSIF ~BRW1.Q.MYF:SecondField
>         ReturnValue = EditAction:Forward
>     END
> END
> 
> The ELSIF part was added to stop it saving if the other field (there are
> only 2, and both are required) in my browse was not filled in.
> 
> My problem is twofold.  Firstly, I can't trap for loss of focus (i.e. the
> user clicking the mouse elsewhere).  I want to always save on loss of focus,
> so I have this option set, but this then doesn't allow the above code to
> run.

   First move the validation to the ValidateField method.
Then in the TakeFocusLoss method, before the parent call,

  if (Brwx.Primary.Me.ValidateField(Where(Brwx.Q,
                             Brwx.Q.Pre:Field) ) = Level:Notify
    Self.Again = true
    Self.ClearColumn()
    Self.Column = where(Brw1.Q, Brw1.Q.Par:Nomen)
    Self.ResetColumn()
    presskey(tabkey)
    return
  end

  That will handle mouse clicks.

  For the down arrow key the process is about the same except you want to
use the TakeAction method, before the parent call and test for
EditAction:Next, Previous then set the Action parameter to EditAction:None



Printed November 21, 2024, 10:43 am
This article has been viewed/printed 35215 times.