Works with versions 5.0 and up. Handles different data types.
Easy to use INFO messagebox. Brings up the correct ICON and title.
SAVE this procedure as one of your public methods in your classlib OR procedure file.
SEE FAQ - MESSAGEBOX YESNO for more details.
To test this code. Copy the entire FAQ, including comments, into a program, save and run it. The comments are ignored since they are contained in #IF/#ENDIF statements.
Also, be sure to change the message to test numeric and date datatypes.
#ENDIF
PUBLIC tcSystem
tcSystem = "Tek Tip"
INFO("The calculation is complete.")
*******************************************************************************
PROCEDURE INFO
LPARAMETER tcMessage,tcTitle
IF PCOUNT() = 0
tcMessage = "Duh... No Message Passed"
ENDIF
LOCAL lctransform, lnDecimals, lnInteger, lni
DO CASE
CASE TYPE('tcMessage') = 'C'
* fall thru on character types
CASE TYPE('tcMessage') = 'D'
tcMessage = "Date Data Type:" + ;
CHR(13)+CHR(10) + CHR(13)+CHR(10) + DTOC(m.tcMessage)
CASE TYPE('tcMessage') = 'L'
IF m.tcMessage
tcMessage = ".T."
ELSE
tcMessage=".F."
ENDIF
tcMessage = "Logical Data Type:" + ;
CHR(13)+CHR(10) + CHR(13)+CHR(10) + m.tcMessage
CASE TYPE('tcMessage') = 'N'
lnDecimals = SET('DECIMALS')
lnInteger = LEN(ALLTRIM(STR(INT(m.tcMessage))))
IF lnInteger <= 3
lctransform = replicate('9',m.lnInteger) + '.' + replicate('9',m.lnDecimals)
ELSE
lctransform = '
FOR lni = 1 to m.lnInteger
IF LEFT(m.lctransform,3) = '999'
lctransform = ',' + m.lctransform
ENDIF
lctransform = '9' + m.lctransform
ENDFOR
lctransform = m.lctransform + '.' + replicate('9',m.lnDecimals)
ENDIF
tcMessage = TRANSFORM(m.tcMessage,'&lctransform')
tcMessage = "Numeric Data Type:" + ;
CHR(13)+CHR(10) + CHR(13)+CHR(10) + m.tcMessage
ENDCASE
IF PCOUNT() = 1
* no title - default to system name
tcTitle = tcsystem
ENDIF
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.