General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only