Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Messagebox - INFO

Tips -N- Tricks

Messagebox - INFO

by  jimoo  Posted    (Edited  )
* By Jim Osieczonek, www.deltbg.com

#IF .F.

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

RETURN MESSAGEBOX(tcMessage,0 + 64,m.tcTitle)
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top