The following code is from the UTIL procedure library in CodeBook 3.0, 6.0 and 6.1:
<b>FUNCTION ErrorMsg(tcMessage, tnOptions, tcTitle) LOCAL lnOptions, ; lcTitle
IF PCOUNT() < 3 lcTitle = APPNAME_LOC ENDIF
IF PCOUNT() < 2 lnOptions = MB_ICONEXCLAMATION ENDIF
?? CHR(7) MESSAGEBOX(tcMessage, lnOptions, lcTitle) RETURN ENDFUNC</b>
I can't see how this can work if the second parameter <u>is</u> actually supplied. I get a parameter type error. How about this instead?:
<b>function ErrorMsg(tcMessage, tnOptions, tcTitle) local lnOptions, ; lcTitle
if pcount() > 1 lnOptions = tnOptions if pcount() > 2 lcTitle = tcTitle else lcTitle = APPNAME_LOC endif else lnOptions = MB_ICONEXCLAMATION lcTitle = APPNAME_LOC endif
?? chr(7) = messagebox(tcMessage, lnOptions, lcTitle) return endfunc</b>
On the other hand, we could just eliminate the second and third parameters altogether along with the <b>pcount()</b> checking since nobody apparently uses either of those parameters anyway. (Except the one time I did, of course.)
Jim Hansen Canyon Country Consulting ©2001 James H. Hansen |