Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A simple Prompting ww.prg Which help a lot other than de
Message
De
04/03/1998 05:11:52
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
04/03/1998 03:46:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00082427
Message ID:
00082432
Vues:
30
>I have write the following code, to simple save as ww.prg
>Then, you generate can use it in most data type!! ^_^'
>
>LPARAMETERS MSG1, MSG2, MSG3, MSG4, MSG5, MSG6, MSG7
>LOCAL OUTPUT, SEMIMSG  && Semimsg is to transform the parameter to 'C'
>
>OUTPUT = ""
>FOR X = 1 TO PCOUNT()
>  IF X > 1
>    OUTPUT = OUTPUT + CHR(13)
>  ENDIF
>  SEMIMSG = EVAL('MSG'+ALLTRIM(STR(X)))
>  DO CASE
>    CASE TYPE("SEMIMSG") == "N"	OR TYPE("SEMIMSG") == "Y"
>        * CHANGE NUMBER TO STRING
>	SEMIMSG = ALLTRIM(STR(SEMIMSG))
>    CASE TYPE("SEMIMSG") == "D" && CHANGE DATE TO STRING
>	SEMIMSG = ALLTRIM(DTOC(SEMIMSG))
>    CASE TYPE("SEMIMSG") == "T"	&& CHANGE TIME TO STRING
>	SEMIMSG = ALLTRIM(TTOC(SEMIMSG))
>    CASE TYPE("SEMIMSG") == "O"	&& CHANGE OBJECT TO STRING
>	SEMIMSG = "NAME: " +ALLTRIM(SEMIMSG.NAME) + CHR(9) + ;
>        SEMIMSG = SEMIMSG + "CLASS: " + ALLTRIM(SEMIMSG.CLASS)
>  ENDCASE
>	
>  OUTPUT = OUTPUT + ALLTRIM(STR(X)) + ":" + CHR(9) + SEMIMSG
>ENDFOR
>
>IF !EMPTY(OUTPUT)
>  WAIT "&OUTPUT" WINDOW NOWAIT
>ELSE
>  WAIT "Nothing Here" WINDOW NOWAIT
>ENDIF
>
>As passing parameter is max. 27!
>if possible to use array in passing, then help a lot!
>Because Tray program by debug bit-by-bit is quite time-waste!
>
>So, Pls help me on handling Array!!
>Thanks!!
So you want the array version ? OK here it's with some modification to code :
>
oTestObj=createobject("Form")
dimension aMsgElems[6]
aMsgElems[1] = "Hello"
aMsgElems[2] = {01/01/1998}
aMsgElems[3] = 987
aMsgElems[4] = oTestObj
aMsgElems[5] = {01/01/1998 10:02}
msgVal=DisplayMsg(@aMsgElems, 67, "Test message")
oTestObj.release
? msgVal

function DisplayMsg
LPARAMETERS aMsgElems, nDialogBoxType , cTitleBarText
LOCAL ix,OUTPUT, SEMIMSG  && Semimsg is to transform the parameter to 'C'
OUTPUT = ""
nArrayLen = alen(aMsgElems,1)
FOR iX = 1 TO nArrayLen
  DO CASE
    CASE TYPE("aMsgElems[ix]") $ "NY"
        * CHANGE NUMBER TO STRING
        SEMIMSG = ALLTRIM(STR(aMsgElems[ix]))
    CASE TYPE("aMsgElems[ix]") $ "D" && CHANGE DATE TO STRING
		SEMIMSG = ALLTRIM(DTOC(aMsgElems[ix]))
    CASE TYPE("aMsgElems[ix]") $ "T"	&& CHANGE TIME TO STRING
		SEMIMSG = ALLTRIM(TTOC(aMsgElems[ix]))
    CASE TYPE("aMsgElems[ix]") $ "O"	&& CHANGE OBJECT TO STRING
		SEMIMSG = "NAME: " +ALLTRIM(aMsgElems[ix].NAME) + CHR(9) + ;
                  "CLASS: " + ALLTRIM(aMsgElems[ix].CLASS)
    CASE TYPE("aMsgElems[ix]") $ "L"
        SEMIMSG = iif(aMsgElems[ix],"True","False")
    OTHERWISE
        SEMIMSG = ALLTRIM(aMsgElems[ix])
  ENDCASE
  OUTPUT = OUTPUT + ALLTRIM(STR(iX)) + ":" + CHR(9) + SEMIMSG + ;
           iif(ix<nArrayLen,chr(13),"")
ENDFOR

do case
    case parameters() < 2
         return messagebox(output)
    case parameters() < 3
         return messagebox(output, nDialogBoxType)
    otherwise
         return messagebox(output, nDialogBoxType , cTitleBarText)
endcase
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform