A Bit Rusty - SetSelection Question
David Thompson
dthmpsn1 at uiuc.edu
Sat Mar 15 15:31:13 PDT 2008
>My goal is to be able to update the few characters after the period on line
>2 like:
>
>
>This is the title.part
>line2 info here.updatethis
>Line 3 ...
>Line 4 etc....
>
>So line 2 can be like
>line2 info here.updateNEWthis
>
>'TheText' does happen to be a superobject
>
>I'm fooling with :
>search( TheText,".") - how do I make sure it finds the period one line 2 -
>not line 1?
>
>How do I make TheText be an open activesuperobject?
>
>PROC-----
>
>local start, end
>
>How do I make 'end' be the return char in line 2?
>
>if info("activesuperobject")""
>activesuperobject "SetSelection", start,end
>endif
>
>Thanks in advance for your help...
Rather than search(, I would treat carriage
returns and periods as array separators. Then you
could use the length( function to measure the
lengths of the elements.
length(array(TheText,1,¶))
would give you the length of the first line, not
including the carriage return at the end.
length(array(array(2,¶)1,"."))
would give you the length of the second line, up
to but not including the period. So you could use
length(array(TheText,1,¶))+length(array(array2,¶)1,".")+2
to get the location of the period on the second
line. The location of the carriage return at the
end of the second line would be
length(arrayrange,1,2,¶)+1
If the object name of the SuperObject is also TheText, you could use
if info("activesuperobject")=""
SuperObject "TheText", "Open"
EndIf
to open it, if it isn't already open. If this
isn't the only TESO or WPSO on the form, you may
need to do some further testing to make sure you
don't have another SuperObject open that you will
need to close before you can open this one.
Dave
Dave
More information about the Qna
mailing list