Page 1 of 1

How to set cursor location

Posted: Mon Jun 22, 2015 12:42 pm
by samjith
How to set the position of cursor in scrolling text field. I know the line number (say, line 15 of field 1), then how to set the position of cursor.

Re: How to set cursor location

Posted: Mon Jun 22, 2015 12:49 pm
by Klaus
Hi samjith,

check "select" in the dictionary, this will let you position the cursor in a field!

E.g. this will place the cursor at the beginning of line 15 of your field:
...
select before line 15 of fld "samjith's nice field"
...


Best

Klaus

Re: How to set cursor location

Posted: Mon Jun 22, 2015 1:13 pm
by samjith
Hi Klaus,

Thanks for the quick reply. Code works fine.

I need certain replaces, if i select "replace_All" from my popup menu. The text in my screen moves automatically.

I want the changes, but i dont need to changes the text in the screen. :oops:

Re: How to set cursor location

Posted: Mon Jun 22, 2015 1:49 pm
by Klaus
Hi samjith,
samjith wrote: I need certain replaces, if i select "replace_All" from my popup menu. The text in my screen moves automatically.
I want the changes, but i dont need to changes the text in the screen. :oops:
sorry, I'm afraid I don't understand what your problem is?


Best

Klaus

Re: How to set cursor location

Posted: Mon Jun 22, 2015 2:28 pm
by samjith

Code: Select all

case Revert_Once
         put gmouse_line into RevertLine
         if backgroundColor of button "UK" is red then
            put the htmlText of  RevertLine into myR
            replace "<strike><font bgcolor=" & quote & "#FFFF00" & quote & ">" & gUS & "</font></strike><font bgcolor=" & quote & "#00FF00" & quote & ">" & gUK & "</font>" with "<font bgcolor=" & quote & "#00FF00" & quote & ">" & gUS & "</font>"  in myR 
            set the htmlText of  RevertLine to myR
            put myR into gmouse_line
         end if 
         if backgroundColor of button "US" is red then
            put the htmlText of  RevertLine into myR
            replace "<strike><font bgcolor=" & quote & "#FFFF00" & quote & ">" & gUK & "</font></strike><font bgcolor=" & quote & "#00FF00" & quote & ">" & gUS & "</font>" with "<font bgcolor=" & quote & "#00FF00" & quote & ">" & gUK & "</font>"  in myR 
            set the htmlText of  RevertLine to myR
            put myR into gmouse_line
         end if
         
         select before  LineFinder 
         --unlock screen
         --lock cursor
         break
This is one of the code in my popup menu.
I have a txt file of more than 1000 line in my scrolling field.
If i select the above mentioned code from my popup menu. then replacement works fine. But the problem is that the text in scrolling field scrolls automatically


It is very difficult for me, to find the current line i worked before selecting the popup menu.

Re: How to set cursor location

Posted: Mon Jun 22, 2015 2:38 pm
by Klaus
Hi samjith,

aha, now I get it (more or less) :D
I would try to store the current scroll of the field BEFORE replacing etc, and set it back again afterwards.
...
put the scroll of fld "your field here" into tOldScroll
case ...
## Do your replace etc. here...
...
set the scroll of fld "your field here..." to tOldScroll
break
...
At least worth a try!


Best

Klaus

Re: How to set cursor location

Posted: Tue Jun 23, 2015 5:44 am
by samjith
Hi Klaus,

Code works fine. Thanks for giving that wonderfull idea. :D






Cheers

Samjith