Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MLCOUNT() and MEMOLINE()?
Message
De
01/05/2011 06:14:43
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
29/04/2011 18:19:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Divers
Thread ID:
01508891
Message ID:
01508926
Vues:
132
>Hi friends
>
>Before invent an UDF I ask you.
>
>Clipper has two very useful functions named "MLCOUNT()" and "MEMOLINE()" both very similar to ALINES() or MEMLINES() but they don't work as I would like.
>
>What I need is separate a string in as lines as necesary so that I can print it in a ticket printer. I do this in Clipper but I can't get it in VFP.
>
>MLCOUNT() and. MEMOLINE() are "inteligents" functions. They don't truncate words.
>
>I tried creating a cursor because VFP help says "memo fields" and "SET MEMOWIDTH" is mentiones too many times... But the result of "MEMLINES(cString,n,_MLINE)" is the nearest I could be from what I want but it doesn't return a string.
>
>Sometime someone here told me about a few functions that are not in VFP help. Perhaps I'm doing something wrong or there is a function that I don't know.
>
>
>   ANTMEMO=SET('MEMOWIDTH')
>   SET MEMOWIDTH TO 33
>   DESCRI=ALLTRIM(DDESC)
>   CREATE CURSOR MDESCRIP (MNOMBRE M(4))
>   APPEND BLANK
>   REPLACE MNOMBRE WITH DESCRI
>   N=1
>   DO WHILE !EMPTY(MLINE(MNOMBRE,N,_MLINE))
>      ??? PADR(mLINE(MNOMBRE,n,_MLINE),33)
>      N=N+1
>   ENDDO   
>   SET MEMOWIDTH TO ANTMEMO
>
>
>Thank you

I'm not sure you're getting the correct result if calling mline() with _mline and n>1. _mline is updated on every call, and contains the offset of the last byte retrieved during the last call (which would coincide with the beginning of the next line). Next call, if _mline is included as the offset parameter, starts from that last offset - and your second parameter is the ordinal number of the line starting from that point, so it would count lines from there. Basically, you're getting the 1st, 3rd, 6th,10th, 15th line etc. Including _mline is much faster (because Fox doesn't have to calculate the position of the line you asked for), but if you want to get ALL the lines, call it with
mLINE(MNOMBRE,1,_MLINE)

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform