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: FourthWorld, heatherlaine, Klaus, kevinmiller

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

Field Scroll Problem

Post by Ralph Forehand » Thu Feb 08, 2018 3:52 am

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?
"Do the right thing and everything else will take care of it's self."

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: Field Scroll Problem

Post by quailcreek » Thu Feb 08, 2018 4:47 am

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.
Tom
MacBook Pro OS Mojave 10.14

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 » Thu Feb 08, 2018 5:45 am

I tried- set the vScroll of field "Play Result" to bottom -with no effect?
"Do the right thing and everything else will take care of it's self."

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

Re: Field Scroll Problem

Post by bogs » Thu Feb 08, 2018 6:31 am

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")
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Field Scroll Problem

Post by dunbarx » Thu Feb 08, 2018 3:42 pm

Or you can set the scroll of the field to 10000000. That ought to be enough.

Craig Newman

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

Re: Field Scroll Problem

Post by bogs » Thu Feb 08, 2018 3:49 pm

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.
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 » Fri Feb 09, 2018 10:22 pm

Craig,

Tried all three of above vie Message Box entry - still doesn't does't work :?:
"Do the right thing and everything else will take care of it's self."

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Field Scroll Problem

Post by jmburnod » Fri Feb 09, 2018 10:58 pm

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
https://alternatic.ch

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 2:53 am

I use LiveCode Version 7.1 Community
"Do the right thing and everything else will take care of it's self."

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 3:00 am

Jean-Marc,
Ulps :oops: Need to test your suggestion BEFORE I answered.
"Do the right thing and everything else will take care of it's self."

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 3:36 am

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'
"Do the right thing and everything else will take care of it's self."

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Field Scroll Problem

Post by [-hh] » Sat Feb 10, 2018 5:22 am

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
shiftLock happens

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 7:34 pm

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
"Do the right thing and everything else will take care of it's self."

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Field Scroll Problem

Post by jmburnod » Sat Feb 10, 2018 8:00 pm

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)
https://alternatic.ch

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

Re: Field Scroll Problem

Post by bogs » Sat Feb 10, 2018 9:28 pm

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?
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”