At 9:36 PM -0700 17/11/1999, Mary Bull wrote:
>Good day! I know I'm missing something here. I'd like to think through
>this openly, and hopefully someone can tell me what I'm screwing up.
>
>The vScroll refers to the top of a field, right? When I get the
>selectedLoc function of the lineOffset(textString,searchField), the
>result is in x,y format for the upper left of the selection, where x is
>the distance from the left of the field, and y is the distance from the
>top of the field (both in pixels). Therefore, if I set the vScroll of
>the field to item 2 of the result of the selectedLoc function, the top
>of the field should display the paragraph containing the textString.

When I mentioned the selectedLoc funtion, I was forgetting about the 
calculations to be done.

The selectedLoc returns the position from the left and top of the 
card. Here is a script of how you might do this. It puts the text in 
question at the top of the field.

put 8 into tMagicNumber -- see below
select line lineOffset(someString, field someField) of field someField
put the top of field someField into tTop
put the scroll of field someField into tScroll
put item 2 of the selectedLoc into tY
put tY - tTop + tScroll into tNewScroll
set the scroll of field someField to tNewScroll - tMagicNumber

tMagicNumber is to tidy it up. Without it, I find the text will be 
slightly above the top of the field. This may be related to the field 
margins, but I'm not sure. 8 seems to work (on Windows anyway).

As Scott mentioned, the new "formatted" properties in 2.3 look much 
esier to use for this kind of thing.

Cheers
Dave Cragg

Reply via email to