>I have a form with a grid and a ADD, Save, Delete buttons. The ADD changes to Cancel. Why do I have to click twice on the Cancel button to cancel an ADD? here is the code in my valid event. In debug, the grid text shows focus and not the clicked button. Here is the valid event code:
>
>
>* get reference to object under mouse pointer
>oLoc = sys(1270)
>if vartype(oLoc)="L"
> oLoc = This
>endif
>
>* is the location the Close or the Add/Cancel button
>IF inlist(lower(oLoc.name),"cmdclose","cmdAdd")
> RETURN .T.
>ELSE
> SomeCode
>ENDIF
>
>
>Thanks, Chuck
I don't know, but I find it easier to postpone most validation until the record is saved. In other words, instead of validating input in the Valid() or LostFocus() event, I put all validation in the method that saves changes to the current record.
A validation function consults a table of validation rules, and shows the user the corresponding error messages.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)