Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Oct 13, 2019 11:22 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: insert text into WebTextArea at cursor
PostPosted: Mon Sep 12, 2011 9:36 pm 
Offline

Joined: Mon Sep 12, 2011 9:23 pm
Posts: 1
WebTextArea has many fewer properties than TextArea. However, text may be inserted using WebTextArea.InsertText (oneBasedPosition,Text). Is there a way to 'remember' the cursor position (as oneBasedPosition) in a webTextArea (like SelStart in TextArea) so that text may be inserted programatically?
Thanks.


Top
 Profile  
Reply with quote  
 Post subject: Re: insert text into WebTextArea at cursor
PostPosted: Tue Nov 27, 2012 3:36 pm 
Offline

Joined: Wed Apr 13, 2011 2:07 pm
Posts: 30
I've the same question... Does anybody know ?


Top
 Profile  
Reply with quote  
 Post subject: Re: insert text into WebTextArea at cursor
PostPosted: Wed Nov 28, 2012 3:23 am 
Offline

Joined: Wed Apr 13, 2011 2:07 pm
Posts: 30
To know the caret position, I've tried to use the javascript selectionStart function.
But, I dont know how to return a value to RS (from js)

please help


Top
 Profile  
Reply with quote  
 Post subject: Re: insert text into WebTextArea at cursor
PostPosted: Sun Dec 02, 2012 7:54 am 
Offline

Joined: Wed Apr 13, 2011 2:07 pm
Posts: 30
I've found a solution totally written in javascript :

Sub jsInsertText(Extends obj As WebTextControl, s as String)
dim sl as string
dim myField as string

if obj=nil then return

myField = "RS.controls['"+ obj.ControlID +"'].field()"

Dim js As String = ""

js = js + "var startPos=" + MyField +".selectionStart;"+EndOfLine
js = js + "var endPos=" + MyField +".selectionEnd;"+EndOfLine
js = js + MyField + ".value=" + MyField + ".value.substring(0, startPos) + '"+s+"'+" + MyField + ".value.substring(endPos," + MyField + ".value.length);"+EndOfLine
js = js + "markControlChanged( RS.controls['"+ obj.ControlID +"'] );"+EndOfLine

obj.ExecuteJavaScript( js )


End Sub


to use it :

theTextControl.jsInsertText "text to insert"


Valery Tarondeau


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group