******************************************************************** * Description.......: CancelValidation * Calling Samples...: * Parameter List....: * Created by........: ideas by John Koziol /Cetin Basoz * Modified by.......: NN ******************************************************************** LOCAL llReturn, loObject loObject = SYS(1270) && Reference to an object under mouse llReturn = .f. IF VARTYPE(m.loObject) = "O" AND LOWER(m.loObject.name) = "cmdcancel" AND MDOWN() llReturn = .t. endif return m.llReturn or lastkey()= 46 OR thisform.ReleaseType = 1 && Alt+C (shortcut for Cancel)>.Top is relative to its parent. ObjToClient result is relative to form.
>>local nCancelTop, nCancelHeight, nCancelLeft, nCancelWidth, llReturn, lnMousePosY, lnMousePosX >>lnMousePosY = mrow(thisform.name,3) >>lnMousePosX = mcol(thisform.name,3) >>with thisform.pgPatient.pages(thisform.pgPatient.activepage) >> nCancelTop = OBJTOCLIENT(.cmdCancel, 1) >> nCancelBottom = m.nCancelTop + OBJTOCLIENT(.cmdCancel, 4) >> nCancelLeft = OBJTOCLIENT(.cmdCancel, 2) >> nCancelRight = m.nCancelLeft + OBJTOCLIENT(.cmdCancel, 3) >>endwith >> >>llReturn = .f. >> >>if between(m.lnMousePosY,m.nCancelTop,m.nCancelBottom) and ; >> between(m.lnMousePosX,m.nCancelLeft,m.nCancelRight) and ; >> mdown() >> llReturn = .t. >>endif >> >>return m.llReturn or lastkey()= 46 or thisform.releasetype = 1 && Alt+C (shortcut for Cancel)