Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting text from a specific line
Message
From
06/02/2016 04:52:39
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
05/02/2016 12:59:01
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01630920
Message ID:
01630998
Views:
57
>>>>On a form I have an editbox with a long text, so the text shows as many separate lines. Is it possible to for instance read the text in line 5 programmatically?
>>>AFAIK no,
>>>If you have set Anchor property of this EditBox and resize the form, then you will have different text in 5th line.
>>
>>That's what I thought, also.
>>
>>What I really want, is a function which can split text into separate lines. I want pass two parameters, the text and the number of characters per line, and to have the formatted text returned. Every line, except the last one, should end with chr(13)+chr(10). I don't want words to be split, and I don't want signs, like comma, point, exclamation mark and so on to be moved to the beginning of a new lines. Sounds easy, but I have found it to be much trickier that I thought. Or maybe it's just me who have entered weekend mode too early?
>
>Are you assuming monospace font (given that you state each line having a specific number of characters) ? If you can assume monospace font, then setting _MLINE to the number of characters per line

...is not what you had in mind. That's set("memowidth"). _mline is the offset from which to start looking, left so by the previous use of mline(). It's intended to work like this

?mline(lcVarWithLongText, 1, _mline)

Do this in a loop and it won't get much slower as it runs, but it would without the third parameter and the varying 2nd.

>and using ALINES() will probably give you something close. On the other hand if you want it to work with proportional fonts, then it will probably a tad more complicated (e.g. "walk" through each "paragraph" [e.g..text separated by newline sequence] word-by-word trying to "fill" line buffer with as much text [using TXTWIDTH() to measure the size] before it exceeds the specified line length).

True, the difference between len() and value calculated through txtWidth() will vary, mostly depending on the number of uppercase characters. Abbreviations usually make it longer :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform