Page 1 of 2

Field Scroll Problem

Posted: Thu Feb 08, 2018 3:52 am
by Ralph Forehand
I needed to enlarge a a Field and it’s Text in my stack. I used the Fields Basic Properties - Size & Position and Text Formatting - menu options to do so.

BUT now when I enter text from a script or open the stack the field scrolls to the top vs stay at the end of the entry.

Text entered from a script enters the last line of rge field correctly.

What am I missing?

Re: Field Scroll Problem

Posted: Thu Feb 08, 2018 4:47 am
by quailcreek
That is the default for a text fld, to scroll to the top. If you need the fld to scroll to the bottom. You can change it by setting the vScoll of the fld.

Re: Field Scroll Problem

Posted: Thu Feb 08, 2018 5:45 am
by Ralph Forehand
I tried- set the vScroll of field "Play Result" to bottom -with no effect?

Re: Field Scroll Problem

Posted: Thu Feb 08, 2018 6:31 am
by bogs
I think what you'd be looking for would be more like this -
6.5 Dictionary for vscroll, comments section wrote: kspieldenner - 2010-02-02 at 15:43:49
-------------------------------------------------------------------------------
Scroll to the bottom of a field, accounting for size of font...
set the vscroll of fld "fData" to (the effective textheight of fld "fData") * (the number of lines in fld "fData")

Re: Field Scroll Problem

Posted: Thu Feb 08, 2018 3:42 pm
by dunbarx
Or you can set the scroll of the field to 10000000. That ought to be enough.

Craig Newman

Re: Field Scroll Problem

Posted: Thu Feb 08, 2018 3:49 pm
by bogs
Googolplex, it is the only way to be sure :P

Just kidding, there are a lot of ways you can do it, or even fake it a bit.

Re: Field Scroll Problem

Posted: Fri Feb 09, 2018 10:22 pm
by Ralph Forehand
Craig,

Tried all three of above vie Message Box entry - still doesn't does't work :?:

Re: Field Scroll Problem

Posted: Fri Feb 09, 2018 10:58 pm
by jmburnod
As Craig said
set the vscroll of fld 1 to 100000000
put the vscroll of fld 1
Doesn't work ?
Which LC version do you use ?
Best regards
Jean-Marc

Re: Field Scroll Problem

Posted: Sat Feb 10, 2018 2:53 am
by Ralph Forehand
I use LiveCode Version 7.1 Community

Re: Field Scroll Problem

Posted: Sat Feb 10, 2018 3:00 am
by Ralph Forehand
Jean-Marc,
Ulps :oops: Need to test your suggestion BEFORE I answered.

Re: Field Scroll Problem

Posted: Sat Feb 10, 2018 3:36 am
by Ralph Forehand
Tried it;
set the vscroll of fld “Play Result” to 100000000
put the vscroll of fld “Play Result”

And got;
Script compile error: :cry:
Error description: set: missing 'to'

Re: Field Scroll Problem

Posted: Sat Feb 10, 2018 5:22 am
by [-hh]
set the vscroll of fld “Play Result” to 100000000
Don't use smart quotes. Use ordinary quotes:

set the vscroll of fld "Play Result" to 100000000

Re: Field Scroll Problem

Posted: Sat Feb 10, 2018 7:34 pm
by Ralph Forehand
set the vscroll of cd fld "Play Result" to 10000000
put the vscroll of cd fld "Play Result"

Works without an entry error BUT after data into the field, it still returns to the top line :?:
vScroll = 0 :?: :?:

BTW - I am usung OS X

Re: Field Scroll Problem

Posted: Sat Feb 10, 2018 8:00 pm
by jmburnod
BUT after data into the field, it still returns to the top line
Yes. I think that is what is expected.
What about this to display the end of text

Code: Select all

put myData into fld  "Play Result"
set the vscroll of fld "Play Result" to 10000000
cd fld
I guess you're an hypercard baby (there is no cd fields in LC, only fields)

Re: Field Scroll Problem

Posted: Sat Feb 10, 2018 9:28 pm
by bogs
Just curious, did you try the script I posted above from the dictionary? Because that seems to be exactly what you are looking for as far as I can tell.

I made a test stack, 2 cards, a scrolling field named "Field" on the first, and a regular label on the second with the default name.

I put this code into the stack -

Code: Select all

on openCard
   get the childControlNames of this card
   if it is "Field" then
      put "this new text is added by script" & cr after field "Field"
      set the vscroll of field "Field" to (the effective textheight of field "Field") * (the number of lines in field "Field") 
   end if
end openCard

on mouseUp
   go to the next card
end mouseUp
When I click on the card, it switched between the two cards, when it switched back to the scrolling field card, that field was always at the bottom regardless of whether text was added manually or by script to either the top or bottom of the field.

Unless I'm missing the point, isn't that what your trying to do?