Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FPW 2.6 to VFP8.0 syntax
Message
From
03/05/2004 22:09:30
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
03/05/2004 19:22:52
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00900557
Message ID:
00900581
Views:
10
In general, VFP (all versions) are very good at backward-compatibility. That is, you can use the code as-is, and only have to do changes now and then for some specific problems. But mainly, you would do changes to take advantage of some new features, like buffering, transactions, OOP, etc.

In your code, you might change the PRIVATE variables to LOCAL - if they are only used in the procedure itself. If they are required in a lower-level procedure, keep them private.

For alert(), you can now use the built-in MessageBox() function. However, MessageBox() only allows some predefined texts, like "Accept", "Cancel", etc.


>HI,
>
>Can someone helps me to translate FPW to VFP codes as suggestions for
>the following procedures :
>
>Tia
>
>
>*=================================================
>procedure V_SENDTO
>*** Validation for laSENDTO list box
>
>private lnREPLY, lcROUTER, lcSENDTO, lcDESTID, lcOPTIONS
>
>if !glEDITABLE
> *** Can't change it
> return .t.
>endif
>
>if not between(lnSENDTO, 1, alen(laSENDTO,1)) ;
>or empty(laSENDTO[lnSENDTO,1])
> *** Nothing pointed to
> return .t.
>endif
>
>*** Ask user what to do
>if gcLANG = "E"
> lnREPLY = alert("Delete or modify this destinee?", 0, ;
> "\!\>else
> lnREPLY = alert("Supprimer ou modifier ce destinataire ?", 0, ;
> "\!\>endif
>
>do case
>case lnREPLY = 1
> *** Modify
> *-- Extract combined info line from laSENDTO
> lcSENDTO = laSENDTO[lnSENDTO, 2]
> *-- Extract driver
> lcROUTER = trim(left(lcSENDTO, 5))
> lcSENDTO = substr(lcSENDTO,6)
> *-- Extract destinee (expression)
> lnAT = at(chr(0), lcSENDTO)
> if lnAT = 0
> *** This shouldn't happen
> return
> endif
> lcDESTID = left(lcSENDTO, lnAT-1)
> *-- Extract options
> lcOPTIONS = substr(lcSENDTO, lnAT+1)
>
> *** Call driver to modify the destinee(s)
> do ("SND" + lcROUTER) with "CHOOSEDEST", lcOPTIONS, lcDESTID
>
> *** Put results back into laSENDTO array
> laSENDTO[lnSENDTO,2] = ;
> padr(lcROUTER,5) + lcDESTID + chr(0) + lcOPTIONS
> do MakeCol1 with lnSENDTO
>
>case lnREPLY = 2
> *** Delete the line
> if alen(laSENDTO,1) = 1
> laSENDTO = ""
> else
> = adel(laSENDTO, lnSENDTO)
> dimension laSENDTO[alen(laSENDTO,1)-1, 2]
> endif
>
>case lnREPLY = 3
> return
>endcase
>
>show get lnSENDTO
>return
>
>*=================================================
>procedure MakeCol1
>*** Creates Column 1 of laSENDTO from column 2.
>
>parameter lnROW
>
>if empty(laSENDTO[lnROW,2])
> laSENDTO[lnROW,1] = ""
>else
> laSENDTO[lnROW,1] = ;
> proper(trim(left(laSENDTO[lnROW,2], 5))) + ": " + ;
> leftto(substr(laSENDTO[lnROW,2], 6), chr(0))
>endif
>return
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform