FUNCTION AskYN(xMsg, lDefault) // works on TXT or GUI LOCAL cMsg:="", nChoice:=0, i, nDefault, cType:=VALTYPE(xMsg) nDefault:=IIF(IIF(lDefault=NIL, .T., lDefault), 1, 2) IF cType=="A" FOR i:=1 TO LEN(xMsg) cMsg:=IIF(EMPTY(cMsg), xMsg[i], cMsg+";"+xMsg[i]) // so DC_ALERT can handle it. NEXT ELSEIF cType=="C" cMsg:=xMsg ELSE DC_ALERT("AskYN function passed invalid type "+cType) RETURN(.F.) ENDIF CLEAR TYPEAHEAD WHILE(nChoice==0) // do not allow Escape. nChoice:=DC_ALERT(cMsg, {"~Yes", "~No "},,,,, nDefault) // DUAL ENDDO RETURN( IIF(nChoice==1, .T., .F.) ) *****************************************************************************