Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SelText problem in Editbox
Message
From
20/12/2002 03:31:34
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00734470
Message ID:
00734800
Views:
15
Hi,

I forgot to mention that after the selection I add
HTML codes to the selection, then replace the editbox
with the changed text.

Here is a sample code where you can demonstrate
this behaviour. First, you must create a form where
there is a EditBox field (named "EditBox1") and a
command button, which performs the following code
(adding "bold" HTML codes):

*----------------------------------------------------*

* This happens when user has clicked the "Bold"
* button -> HTML "bold" codes are added to the
* selection

* user has written something to the EditBox
loTEXT = THISFORM.EditBox1

* selected text properties
lcSELTEXT = loTEXT.SelText
lnSELSTART = loTEXT.SelStart
lnSELLENGTH = loTEXT.SelLength

* here I checked what the lcSELTEXT variable
* contains:
messagebox(lcSELTEXT)

* and here I added some HTML to the selection:
lcNEWTEXT = ''+lcSELTEXT+''

* now the editbox is filled with the changed text:
THISFORM.EditBox1.Value = ;
stuff(THISFORM.EditBox1.Value,lnSELSTART,lnSELLENGTH,lcNEWTEXT)

*---------------------------------------------------------------*

When I tested this, I first wrote the following text
to the editbox:

this is the first row
this is the second row
this is the third row

Then, I selected the words "second row". The lcSELTEXT is correct
and the changed text looks like this (notice the extra "w"):

this is the first row
this is thesecond roww
this is the third row

When I after this add a fourth row:

and this is the fourth row

and then select the word "fourth", the lcSELTEXT variable
contains: "urth r"

and the text is changed this way:

this is the first row
this is thesecond roww
this is the third row
and here is the furth rrow
Previous
Reply
Map
View

Click here to load this message in the networking platform