Hi Benoit---
Try the following code. Substitute the cancel button name and MyForm with your forms Name.
LOCAL nCancelTop,nCancelHeight,nCancelLeft,nCancelWidth
nCancelTop=THISFORM.cmdCancel.Top
nCancelBottom=nCancelTop+THISFORM.cmdCancel.Height
nCancelLeft=THISFORM.cmdCancel.Left
nCancelRight=nCancelLeft+THISFORM.cmdCancel.Width
IF BETWEEN(MROW("MyForm",3),nCancelTop,nCancelBottom) AND ;
BETWEEN(MROW("MyForm",3),nCancelLeft,nCancelRight) AND ;
MDOWN()
RETURN .T.
ENDIF
This will blow off data validation while confirming the cancel button has been clicked on.
Ummmmm...I haven't actually tried this, but maybe in the Valid method you could test MROW() and MCOL() values and if they are in the area of the Cancel button then RETURN .T.
>Hi everybody !
>
>I alredy asked this question a couples of day ago in frecnh but I think my question was misunderstood and I think most of peoples here are talking english !!
>
>When I'm in a TEXTBOX control, I would like to know in the valid event the name of the ontrol who wants the focus... My valid event forces the user to enter a valid string and doesn't allow the user to click cancel !!! So in the valid event, I would like to know if the use clicked on the cancel button before testing the value of the string in my TEXTBOX...
>
>I hope my english is good enough for everybody !
>
>Tanks
>
>Benoit Grenier
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05