INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Tips -N- Tricks

Messagebox - INFO by jimoo
Posted: 24 Oct 03

* 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)

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close