Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get line no text selection start and end postion
Message
De
20/11/1999 19:37:58
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00293435
Message ID:
00293565
Vues:
31
SET MEMOWIDTH can be adjusted, and code will count real line breaks, not perceived ones. To get control of perceived breaks (if they're allowed), the font should be set as 'Courier New'. I mean that's all doable, depends on what is the real purpose: unfortunately, it was not disclosed in the intial post.

>Ed,
>
>FWIW, there's little chance that the code will work. The SET MEMOWIDTH affects memlines and neither one have anything to do with the font properties of the editbox which will control the percieved line breaks inside the control.
>
>>>Can anyone has an idea how can we get start and end position of selection relative to line in multi line edit box. I have used selstart and sellength but it always give me the postion from the first line of editbox text.
>>>
>>>Thanks
>>
>>You can count length of eac line in memo, and calculate the needed position:
>>
>>function getrelativeselstart
>>lparameter nSelstart   && this is editbox.selstart property
>>nLines=memlines(memofield)
>>nLength=0
>>For n=1 to nLines
>> if nLength+len(mline(memofield,n))+2>nSelstart
>>   return nSelstart-nLength
>> endif
>> nLength=nLength+len(mline(memofield,n))+2  && allow 2 for chr(13)+chr(10)
>>Endfor
>>
>>
>>This is the idea. I did not test this code so check it carefully when implementing.
Edward Pikman
Independent Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform