Selecting text in fields - scroll behavior

Sarah sarahr at genesearch.com.au
Wed Aug 13 19:57:00 EDT 2003


>   I want to select some text in a field.  I've using
>
> select char startChar to endChar of fld "fCode"
>
> where fCode has the List Behavior property set.  It works, but if I 
> tell it to select a range that isn't in the current scroll range, it 
> scrolls so that the *bottom* of the selection is visible, and I'd like 
> the *top* (and the whole thing) is visible.  Is there a way to do > this.
This may be inherent in the engine i.e selecting a non-visible range 
may always scroll to the bottom of the range rather than the top. You 
could set the vScroll manually after selecting, or (totally untested) 
what happens if you select backwards i.e. select char endChar to 
startChar of fld "fCode"
>
>   Or is there a better way to do text hiliting like this.  I only need 
> to select whole lines, so I first tried "select line x to x".  This 
> works (but only if list behavior is turned on), but I need a way to 
> get the line numbers out of matchChunk, which only returns character 
> offsets..  So I'm back to selecting characters.
To get from character positions to line positions, use something like 
this:
	put the number of lines in char 1 to charNum of fld "fCode" into 
lineNum

Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/




More information about the use-livecode mailing list