Valid Event 
Author Message
 Valid Event

I'm using a valid event for each control in a Customer
entry of a program.

My problem is, when the user click another button Cancel
button for example, the valid event fires and the user can
not cancel until all data is correct.

I use the AMOUSEOBJ() to verify was object was clicked and
work very well, but, when the mouse is over the cancel
button TABing from a control to another bypass the
validation because the AMOUSEOBJ returns the Cancel button
in the first element of the array.

Can anyone help me...

any form to know what control is the next in fire an
event, or what control will receive the focus after the
valid event.

Thanks...



Fri, 02 Sep 2005 02:07:06 GMT  
 Valid Event
You can use Lastkey() in the Valid event as long as your
CancelButton.Cancel property is .T.
    * procedure YourControl.Valid
    if lastkey()=27
        return .T.
    endif
    * your validation follows here

If OTOH you want to get the next control from the previous'
point of view - the NextControl.When() event takes place
before CurrentControl.LostFocus()
So you could issue "Nodefault" in LostFocus() depending on a
custom property, for example.

hth
-Stefan



Quote:
> I'm using a valid event for each control in a Customer
> entry of a program.

> My problem is, when the user click another button Cancel
> button for example, the valid event fires and the user can
> not cancel until all data is correct.

> I use the AMOUSEOBJ() to verify was object was clicked and
> work very well, but, when the mouse is over the cancel
> button TABing from a control to another bypass the
> validation because the AMOUSEOBJ returns the Cancel button
> in the first element of the array.

> Can anyone help me...

> any form to know what control is the next in fire an
> event, or what control will receive the focus after the
> valid event.

> Thanks...



Fri, 02 Sep 2005 18:36:44 GMT  
 Valid Event
Be careful, When() triggers before LostFocus() if you click with the mouse.
However, if you use a hotkey, the order is reversed.   I don't care if it is
'by design', it is maddening!


Quote:
> You can use Lastkey() in the Valid event as long as your
> CancelButton.Cancel property is .T.
>     * procedure YourControl.Valid
>     if lastkey()=27
>         return .T.
>     endif
>     * your validation follows here

> If OTOH you want to get the next control from the previous'
> point of view - the NextControl.When() event takes place
> before CurrentControl.LostFocus()
> So you could issue "Nodefault" in LostFocus() depending on a
> custom property, for example.

> hth
> -Stefan



> > I'm using a valid event for each control in a Customer
> > entry of a program.

> > My problem is, when the user click another button Cancel
> > button for example, the valid event fires and the user can
> > not cancel until all data is correct.

> > I use the AMOUSEOBJ() to verify was object was clicked and
> > work very well, but, when the mouse is over the cancel
> > button TABing from a control to another bypass the
> > validation because the AMOUSEOBJ returns the Cancel button
> > in the first element of the array.

> > Can anyone help me...

> > any form to know what control is the next in fire an
> > event, or what control will receive the focus after the
> > valid event.

> > Thanks...



Sat, 03 Sep 2005 03:04:51 GMT  
 Valid Event


Quote:
> Be careful, When() triggers before LostFocus() if you click with the
mouse.
> However, if you use a hotkey, the order is reversed.

Good point.

Thanks
-Stefan



Sat, 03 Sep 2005 15:16:18 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. VFP Cancel out of a Valid Event

2. Valid Event

3. VALID event and cancel

4. Valid event of ComboBox

5. valid event problem

6. Textbox Valid Event

7. Valid Event in VFP form text box

8. Bypassing The Valid Event?...

9. VALID EVENT (Alternative)

10. VALID Event

11. Bypassing Valid event

12. valid event fired when Form Close

 

 
Powered by phpBB® Forum Software