Field Scroll Problem

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

SparkOut
Posts: 2458
Joined: Sun Sep 23, 2007 4:58 pm

Re: Field Scroll Problem

Post by SparkOut » Sat Feb 10, 2018 9:33 pm

Maybe you could handle the textChanged message in the field script to set the vScroll whenever the content changes.

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm
Location: Maryland, USA

Re: Field Scroll Problem

Post by Ralph Forehand » Sat Feb 10, 2018 11:58 pm

set the vscroll of cd field "Play Result" to (the effective textheight of cd field "Play Result") * (the number of lines in cd field "Play Result")

Yes, the above works BUT requires “cd” with field ID - perhaps because this is a HyperCard stack I converted to Revolution/LiveCode years ago and have been using successfulliy . Before I changed the field and text size the field worked as I want - text added to end of field and scroll to stay there .

I enter text from other buttons/fields/message box/keyboard (all on same card)and add to end of field. So adding the above code every time is not practical. What I need is a one time vScroll setting of the field. :?:
"Do the right thing and everything else will take care of it's self."

bogs
Posts: 5259
Joined: Sat Feb 25, 2017 10:45 pm

Re: Field Scroll Problem

Post by bogs » Sun Feb 11, 2018 2:57 am

Ralph Forehand wrote:
Sat Feb 10, 2018 11:58 pm
I enter text from other buttons/fields/message box/keyboard (all on same card)and add to end of field. So adding the above code every time is not practical. What I need is a one time vScroll setting of the field. :?:
You should be able to put that code in any handler and have it work, since it is a field i'd probably roll with sticking it in textChanged of the field itself -

Code: Select all

on textchanged
     set the vscroll of field "Field" to (the effective textheight of field "Field") * (the number of lines in field "Field") 
end textchanged
That should work no matter where the text gets changed from.
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5931
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Field Scroll Problem

Post by jacque » Sun Feb 11, 2018 7:45 pm

Ralph Forehand wrote:
Sat Feb 10, 2018 11:58 pm
set the vscroll of cd field "Play Result" to (the effective textheight of cd field "Play Result") * (the number of lines in cd field "Play Result")

Yes, the above works BUT requires “cd” with field ID - perhaps because this is a HyperCard stack I converted to Revolution/LiveCode years ago and have been using successfulliy .
Yes, that's the reason. For compatibility, imported HC stacks retain original HC references. You can make the stack resolve field and button references like LC does by doing this once from the message box:

Code: Select all

set the HCAddressing of this stack to false


(I'd go with the textchanged handler in the field, too.)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bogs
Posts: 5259
Joined: Sat Feb 25, 2017 10:45 pm

Re: Field Scroll Problem

Post by bogs » Sun Feb 11, 2018 7:54 pm

jacque wrote:
Sun Feb 11, 2018 7:45 pm
(I'd go with the textchanged handler in the field, too.)
...and if all that fails, you can go with 2 big macs, fries, and a soda for $5.00 like I do! Ah the joys of comfort food :mrgreen:
Image

bogs
Posts: 5259
Joined: Sat Feb 25, 2017 10:45 pm

Re: Field Scroll Problem

Post by bogs » Tue Feb 13, 2018 2:42 pm

Yes, but the default can be changed very easily in this case.
Image

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm
Location: Maryland, USA

Re: Field Scroll Problem

Post by Ralph Forehand » Sat Feb 17, 2018 4:35 pm

Have tried all the above without success? :oops:

Have returned to ising back-up Stack for a while.

THANK YOU ALL for your support and input. :roll:

TAKE CARE,
Ralph
"Do the right thing and everything else will take care of it's self."

bogs
Posts: 5259
Joined: Sat Feb 25, 2017 10:45 pm

Re: Field Scroll Problem

Post by bogs » Sat Feb 17, 2018 5:02 pm

Hm. I was diddling around with fields this morning in the quest for more knowledge, there is another place the code I put might be universally targeting a field, and that is in the 'on closeField' handler. Note though, if used, be specific on the field you want it to target, and pass it if you have other fields that change text.
Selection_005.png
closeField
Selection_005.png (6.14 KiB) Viewed 1781 times
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”