Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A simple Prompting ww.prg Which help a lot other than de
Message
From
04/03/1998 20:48:46
 
 
To
04/03/1998 05:11:52
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00082427
Message ID:
00082603
Views:
33
>>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

Well, Cetin. In my point of View, I WILL NOT Alltrim() the Character
variable because it is also Key if the error is forgot to trim it before
searching!!
Escpecially when search the data on Thisform.Textbox2.value!!
always
seek("HK0036     ")
and got nothing!
So, I suggest add a dummy line for CASE:
CASE TYPE("aMsgElems[ix]") $ "C"
* Dummy, with nothing do!
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform