Re: align field scrolls

2017-03-06 Thread Nicolas Cueto via use-livecode
Mike Bonner's solution -- using selectedLoc to set vScroll -- matches
exactly the scrolling effect I'm after.

Thank you, everyone. And, thank you Mike!

--
Nicolas Cueto


On 7 March 2017 at 00:40, Mike Bonner via use-livecode <
use-livecode@lists.runrev.com> wrote:

> An alternate solution..
> If you
> put item 2 of the selectedloc of the first field - item 2 of the
> selectedloc of the second field into tScroll
>
> -- you can then
> set the vscroll of field "your second field" to the vscroll of field "your
> second field" - tScroll
>
> On Mon, Mar 6, 2017 at 8:27 AM, Paul Dupuis via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>
> > You need 3 controls: 2 fields with the vertical scrollbars turned off
> > and a vertical scroller
> > 
> >
> > Set the min of the vertical scrollbar to 0 and the max to the "max(the
> > formattedHeight of field X,formattedHeight of field Y)
> >
> > In the scrollbar, add the script:
> >
> > on scrollbarDrag newPosition
> >   set the vScroll of field X to newPosition
> >   set the vScroll of field Y to newPosition
> > end scrollbarDrag
> >
> >
> > On 3/6/2017 9:39 AM, Rick Harrison via use-livecode wrote:
> > > Hi Nicolas,
> > >
> > > Does the number of lines increase or decrease between executions?
> > >
> > > Have you tried to add or subtract a constant to adjust for the
> > difference?
> > >
> > > Rick
> > >
> > >> On Mar 5, 2017, at 9:45 PM, Nicolas Cueto via use-livecode <
> > use-livecode@lists.runrev.com> wrote:
> > >>
> > >>> Provided both fields have the same number of lines...
> > >>
> > >> ​I should've added that the fields do not contain the same number of
> > >> lines.  They are identical, though, in size and text properties.
> > >>
> > >> Thanks, Paul.
> > >>
> > >> --
> > >> Nicolas Cueto
> > >>
> > >>
> > >> On 6 March 2017 at 11:26, Paul Hibbert via use-livecode <
> > >> use-livecode@lists.runrev.com> wrote:
> > >>
> > >>> I have a stack that does a similar thing, but with numbers and I just
> > use
> > >>> the following script in the main field;
> > >>>
> > >>> on scrollBarDrag pScroll
> > >>>   set the vScroll of fld  “lineNumbers" to pScroll
> > >>>
> > >>> end scrollBarDrag
> > >>>
> > >>> Provided both fields have the same number of lines and the text
> > properties
> > >>> are identical they should stay aligned correctly.
> > >>>
> > >>> Or a simpler version would be;
> > >>> set the vScroll of fld 2 to the vScroll of fld 1
> > >>>
> > >>> Paul
> > >>>
> > >>>
> > >>>
> >  On Mar 5, 2017, at 6:00 PM, Nicolas Cueto via use-livecode <
> > >>> use-livecode@lists.runrev.com> wrote:
> >  Hi.
> > 
> >  The part I've got working...
> > 
> >  Two clickable scrolling fields (fld1, fld2), same height and width.
> > >>> Click a
> >  fld1 line and fld2 SCROLLs and HILITEDLINEs to visually reveal a
> > matching
> >  line. (fld1 is French text, fld2 is an English gloss.)
> > 
> >  The part I would welcome your help with...
> > 
> >  If, say, the hilited line on fld1 is kinda halfway down, how do I
> get
> > the
> >  hilited line on fld2 to also be kinda halfway down?
> > 
> >  Here's my scrolling-magic script:
> > 
> >  set the scroll of fld2 to (tMatchingLineNr - 1) * \
> >    the textHeight of fld2 - the textHeight of fld2
> >  set the hilitedline of fld2 to tMatchingLineNr
> > 
> >  Of course, this ends up with the hilited line of fld2 being at the
> > top.
> >  How do I get it to scroll just that little bit more so that it
> aligns
> > >>> with
> >  the hilited line as seen in fld1?
> > 
> > 
> >  Thank you.
> > 
> >  --
> >  Nicolas Cueto
> >  ___
> >  use-livecode mailing list
> >  use-livecode@lists.runrev.com
> >  Please visit this url to subscribe, unsubscribe and manage your
> > >>> subscription preferences:
> >  http://lists.runrev.com/mailman/listinfo/use-livecode
> > >>> ___
> > >>> use-livecode mailing list
> > >>> use-livecode@lists.runrev.com
> > >>> Please visit this url to subscribe, unsubscribe and manage your
> > >>> subscription preferences:
> > >>> http://lists.runrev.com/mailman/listinfo/use-livecode
> > >> ___
> > >> use-livecode mailing list
> > >> use-livecode@lists.runrev.com
> > >> Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > >> http://lists.runrev.com/mailman/listinfo/use-livecode
> > >
> > > ___
> > > use-livecode mailing list
> > > use-livecode@lists.runrev.com
> > > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> >
> >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url 

Re: align field scrolls

2017-03-06 Thread Mike Bonner via use-livecode
An alternate solution..
If you
put item 2 of the selectedloc of the first field - item 2 of the
selectedloc of the second field into tScroll

-- you can then
set the vscroll of field "your second field" to the vscroll of field "your
second field" - tScroll

On Mon, Mar 6, 2017 at 8:27 AM, Paul Dupuis via use-livecode <
use-livecode@lists.runrev.com> wrote:

> You need 3 controls: 2 fields with the vertical scrollbars turned off
> and a vertical scroller
> 
>
> Set the min of the vertical scrollbar to 0 and the max to the "max(the
> formattedHeight of field X,formattedHeight of field Y)
>
> In the scrollbar, add the script:
>
> on scrollbarDrag newPosition
>   set the vScroll of field X to newPosition
>   set the vScroll of field Y to newPosition
> end scrollbarDrag
>
>
> On 3/6/2017 9:39 AM, Rick Harrison via use-livecode wrote:
> > Hi Nicolas,
> >
> > Does the number of lines increase or decrease between executions?
> >
> > Have you tried to add or subtract a constant to adjust for the
> difference?
> >
> > Rick
> >
> >> On Mar 5, 2017, at 9:45 PM, Nicolas Cueto via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >>
> >>> Provided both fields have the same number of lines...
> >>
> >> ​I should've added that the fields do not contain the same number of
> >> lines.  They are identical, though, in size and text properties.
> >>
> >> Thanks, Paul.
> >>
> >> --
> >> Nicolas Cueto
> >>
> >>
> >> On 6 March 2017 at 11:26, Paul Hibbert via use-livecode <
> >> use-livecode@lists.runrev.com> wrote:
> >>
> >>> I have a stack that does a similar thing, but with numbers and I just
> use
> >>> the following script in the main field;
> >>>
> >>> on scrollBarDrag pScroll
> >>>   set the vScroll of fld  “lineNumbers" to pScroll
> >>>
> >>> end scrollBarDrag
> >>>
> >>> Provided both fields have the same number of lines and the text
> properties
> >>> are identical they should stay aligned correctly.
> >>>
> >>> Or a simpler version would be;
> >>> set the vScroll of fld 2 to the vScroll of fld 1
> >>>
> >>> Paul
> >>>
> >>>
> >>>
>  On Mar 5, 2017, at 6:00 PM, Nicolas Cueto via use-livecode <
> >>> use-livecode@lists.runrev.com> wrote:
>  Hi.
> 
>  The part I've got working...
> 
>  Two clickable scrolling fields (fld1, fld2), same height and width.
> >>> Click a
>  fld1 line and fld2 SCROLLs and HILITEDLINEs to visually reveal a
> matching
>  line. (fld1 is French text, fld2 is an English gloss.)
> 
>  The part I would welcome your help with...
> 
>  If, say, the hilited line on fld1 is kinda halfway down, how do I get
> the
>  hilited line on fld2 to also be kinda halfway down?
> 
>  Here's my scrolling-magic script:
> 
>  set the scroll of fld2 to (tMatchingLineNr - 1) * \
>    the textHeight of fld2 - the textHeight of fld2
>  set the hilitedline of fld2 to tMatchingLineNr
> 
>  Of course, this ends up with the hilited line of fld2 being at the
> top.
>  How do I get it to scroll just that little bit more so that it aligns
> >>> with
>  the hilited line as seen in fld1?
> 
> 
>  Thank you.
> 
>  --
>  Nicolas Cueto
>  ___
>  use-livecode mailing list
>  use-livecode@lists.runrev.com
>  Please visit this url to subscribe, unsubscribe and manage your
> >>> subscription preferences:
>  http://lists.runrev.com/mailman/listinfo/use-livecode
> >>> ___
> >>> use-livecode mailing list
> >>> use-livecode@lists.runrev.com
> >>> Please visit this url to subscribe, unsubscribe and manage your
> >>> subscription preferences:
> >>> http://lists.runrev.com/mailman/listinfo/use-livecode
> >> ___
> >> use-livecode mailing list
> >> use-livecode@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: align field scrolls

2017-03-06 Thread Paul Dupuis via use-livecode
You need 3 controls: 2 fields with the vertical scrollbars turned off
and a vertical scroller


Set the min of the vertical scrollbar to 0 and the max to the "max(the
formattedHeight of field X,formattedHeight of field Y)

In the scrollbar, add the script:

on scrollbarDrag newPosition
  set the vScroll of field X to newPosition
  set the vScroll of field Y to newPosition
end scrollbarDrag


On 3/6/2017 9:39 AM, Rick Harrison via use-livecode wrote:
> Hi Nicolas,
>
> Does the number of lines increase or decrease between executions?
>
> Have you tried to add or subtract a constant to adjust for the difference?
>
> Rick
>
>> On Mar 5, 2017, at 9:45 PM, Nicolas Cueto via use-livecode 
>>  wrote:
>>
>>> Provided both fields have the same number of lines...
>>
>> ​I should've added that the fields do not contain the same number of
>> lines.  They are identical, though, in size and text properties.
>>
>> Thanks, Paul.
>>
>> --
>> Nicolas Cueto
>>
>>
>> On 6 March 2017 at 11:26, Paul Hibbert via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>>
>>> I have a stack that does a similar thing, but with numbers and I just use
>>> the following script in the main field;
>>>
>>> on scrollBarDrag pScroll
>>>   set the vScroll of fld  “lineNumbers" to pScroll
>>>
>>> end scrollBarDrag
>>>
>>> Provided both fields have the same number of lines and the text properties
>>> are identical they should stay aligned correctly.
>>>
>>> Or a simpler version would be;
>>> set the vScroll of fld 2 to the vScroll of fld 1
>>>
>>> Paul
>>>
>>>
>>>
 On Mar 5, 2017, at 6:00 PM, Nicolas Cueto via use-livecode <
>>> use-livecode@lists.runrev.com> wrote:
 Hi.

 The part I've got working...

 Two clickable scrolling fields (fld1, fld2), same height and width.
>>> Click a
 fld1 line and fld2 SCROLLs and HILITEDLINEs to visually reveal a matching
 line. (fld1 is French text, fld2 is an English gloss.)

 The part I would welcome your help with...

 If, say, the hilited line on fld1 is kinda halfway down, how do I get the
 hilited line on fld2 to also be kinda halfway down?

 Here's my scrolling-magic script:

 set the scroll of fld2 to (tMatchingLineNr - 1) * \
   the textHeight of fld2 - the textHeight of fld2
 set the hilitedline of fld2 to tMatchingLineNr

 Of course, this ends up with the hilited line of fld2 being at the top.
 How do I get it to scroll just that little bit more so that it aligns
>>> with
 the hilited line as seen in fld1?


 Thank you.

 --
 Nicolas Cueto
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: align field scrolls

2017-03-06 Thread dunbarx via use-livecode
So if your two fields have different number of lines, you must scale the
"slave" field to the "master. You cannot just align their scroll values.

If the master has, say 100 lines, and the slave 75, you simply set the ratio
of the scroll of the master to its total line count to the ratio of the
slave's similar properties. You may need the "trunc" function to avoid
unnecessary pain and suffering.

Craig 



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/align-field-scrolls-tp4712848p4712853.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: align field scrolls

2017-03-06 Thread Rick Harrison via use-livecode
Hi Nicolas,

Does the number of lines increase or decrease between executions?

Have you tried to add or subtract a constant to adjust for the difference?

Rick

> On Mar 5, 2017, at 9:45 PM, Nicolas Cueto via use-livecode 
>  wrote:
> 
>> Provided both fields have the same number of lines...
> 
> 
> ​I should've added that the fields do not contain the same number of
> lines.  They are identical, though, in size and text properties.
> 
> Thanks, Paul.
> 
> --
> Nicolas Cueto
> 
> 
> On 6 March 2017 at 11:26, Paul Hibbert via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> 
>> I have a stack that does a similar thing, but with numbers and I just use
>> the following script in the main field;
>> 
>> on scrollBarDrag pScroll
>>   set the vScroll of fld  “lineNumbers" to pScroll
>> 
>> end scrollBarDrag
>> 
>> Provided both fields have the same number of lines and the text properties
>> are identical they should stay aligned correctly.
>> 
>> Or a simpler version would be;
>> set the vScroll of fld 2 to the vScroll of fld 1
>> 
>> Paul
>> 
>> 
>> 
>>> On Mar 5, 2017, at 6:00 PM, Nicolas Cueto via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>>> 
>>> Hi.
>>> 
>>> The part I've got working...
>>> 
>>> Two clickable scrolling fields (fld1, fld2), same height and width.
>> Click a
>>> fld1 line and fld2 SCROLLs and HILITEDLINEs to visually reveal a matching
>>> line. (fld1 is French text, fld2 is an English gloss.)
>>> 
>>> The part I would welcome your help with...
>>> 
>>> If, say, the hilited line on fld1 is kinda halfway down, how do I get the
>>> hilited line on fld2 to also be kinda halfway down?
>>> 
>>> Here's my scrolling-magic script:
>>> 
>>> set the scroll of fld2 to (tMatchingLineNr - 1) * \
>>>   the textHeight of fld2 - the textHeight of fld2
>>> set the hilitedline of fld2 to tMatchingLineNr
>>> 
>>> Of course, this ends up with the hilited line of fld2 being at the top.
>>> How do I get it to scroll just that little bit more so that it aligns
>> with
>>> the hilited line as seen in fld1?
>>> 
>>> 
>>> Thank you.
>>> 
>>> --
>>> Nicolas Cueto
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: align field scrolls

2017-03-05 Thread Nicolas Cueto via use-livecode
> Provided both fields have the same number of lines...


​I should've added that the fields do not contain the same number of
lines.  They are identical, though, in size and text properties.

Thanks, Paul.

--
Nicolas Cueto


On 6 March 2017 at 11:26, Paul Hibbert via use-livecode <
use-livecode@lists.runrev.com> wrote:

> I have a stack that does a similar thing, but with numbers and I just use
> the following script in the main field;
>
> on scrollBarDrag pScroll
>set the vScroll of fld  “lineNumbers" to pScroll
>
> end scrollBarDrag
>
> Provided both fields have the same number of lines and the text properties
> are identical they should stay aligned correctly.
>
> Or a simpler version would be;
> set the vScroll of fld 2 to the vScroll of fld 1
>
> Paul
>
>
>
> > On Mar 5, 2017, at 6:00 PM, Nicolas Cueto via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> > Hi.
> >
> > The part I've got working...
> >
> > Two clickable scrolling fields (fld1, fld2), same height and width.
> Click a
> > fld1 line and fld2 SCROLLs and HILITEDLINEs to visually reveal a matching
> > line. (fld1 is French text, fld2 is an English gloss.)
> >
> > The part I would welcome your help with...
> >
> > If, say, the hilited line on fld1 is kinda halfway down, how do I get the
> > hilited line on fld2 to also be kinda halfway down?
> >
> > Here's my scrolling-magic script:
> >
> >  set the scroll of fld2 to (tMatchingLineNr - 1) * \
> >the textHeight of fld2 - the textHeight of fld2
> >  set the hilitedline of fld2 to tMatchingLineNr
> >
> > Of course, this ends up with the hilited line of fld2 being at the top.
> > How do I get it to scroll just that little bit more so that it aligns
> with
> > the hilited line as seen in fld1?
> >
> >
> > Thank you.
> >
> > --
> > Nicolas Cueto
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: align field scrolls

2017-03-05 Thread Paul Hibbert via use-livecode
I have a stack that does a similar thing, but with numbers and I just use the 
following script in the main field;

on scrollBarDrag pScroll
   set the vScroll of fld  “lineNumbers" to pScroll

end scrollBarDrag

Provided both fields have the same number of lines and the text properties are 
identical they should stay aligned correctly.

Or a simpler version would be;
set the vScroll of fld 2 to the vScroll of fld 1

Paul



> On Mar 5, 2017, at 6:00 PM, Nicolas Cueto via use-livecode 
>  wrote:
> 
> Hi.
> 
> The part I've got working...
> 
> Two clickable scrolling fields (fld1, fld2), same height and width. Click a
> fld1 line and fld2 SCROLLs and HILITEDLINEs to visually reveal a matching
> line. (fld1 is French text, fld2 is an English gloss.)
> 
> The part I would welcome your help with...
> 
> If, say, the hilited line on fld1 is kinda halfway down, how do I get the
> hilited line on fld2 to also be kinda halfway down?
> 
> Here's my scrolling-magic script:
> 
>  set the scroll of fld2 to (tMatchingLineNr - 1) * \
>the textHeight of fld2 - the textHeight of fld2
>  set the hilitedline of fld2 to tMatchingLineNr
> 
> Of course, this ends up with the hilited line of fld2 being at the top.
> How do I get it to scroll just that little bit more so that it aligns with
> the hilited line as seen in fld1?
> 
> 
> Thank you.
> 
> --
> Nicolas Cueto
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

align field scrolls

2017-03-05 Thread Nicolas Cueto via use-livecode
Hi.

The part I've got working...

Two clickable scrolling fields (fld1, fld2), same height and width. Click a
fld1 line and fld2 SCROLLs and HILITEDLINEs to visually reveal a matching
line. (fld1 is French text, fld2 is an English gloss.)

The part I would welcome your help with...

If, say, the hilited line on fld1 is kinda halfway down, how do I get the
hilited line on fld2 to also be kinda halfway down?

Here's my scrolling-magic script:

  set the scroll of fld2 to (tMatchingLineNr - 1) * \
the textHeight of fld2 - the textHeight of fld2
  set the hilitedline of fld2 to tMatchingLineNr

Of course, this ends up with the hilited line of fld2 being at the top.
How do I get it to scroll just that little bit more so that it aligns with
the hilited line as seen in fld1?


Thank you.

--
Nicolas Cueto
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode