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
-
saviour
- Posts: 26
- Joined: Wed Feb 05, 2014 5:11 am
Post
by saviour » Tue Apr 15, 2014 4:12 am
Hi guys,
Learning Livecode and it is fun as all. I am facing issues with Native Scroller. I have some text file contents needs to be imported in field "text" which is scrollable in group "scrollArea". As long as the text content is small, there is no problem with scroller and it does fine. But when text size is bigger for same file, either upper or lower part of file goes out of display. Worst is, when content is long, scroller does not work (seems jammed at bottom). I refer to some post regarding the same in the forum, but cannot find an working answer.
I think "formatted height" property of the field is already set when creating the scroller. So field "text" should adjust its length (height) according to its content (either for bigger content or file length increases when text size gets bigger). Isn't it so? Please help me out with necessary codes. Thanks

-
Simon
- VIP Livecode Opensource Backer

- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
Post
by Simon » Tue Apr 15, 2014 4:46 am
Hi saviour,
I think you should "mobileControlDelete "scroller", "loremScroll""control before adding new text in, then recreate the control.
I found this line seems to work better than the other one in the lesson.
http://lessons.runrev.com/s/lessons/m/4 ... ll-a-field
Code: Select all
[code]put 0,0,(the formattedWidth of group "scrollArea"),(the formattedHeight of group "scrollArea") into tContentRect
[/code]
Tell me if that works out for you if not we can try something else.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
saviour
- Posts: 26
- Joined: Wed Feb 05, 2014 5:11 am
Post
by saviour » Tue Apr 15, 2014 3:18 pm
Hi Simon.
Thank you. My problem is solved PARTIALLY. Now, problem of hidden text in upper part of field is solved, even if text size is increased.
Now, what to be done for bottom part if text is longer? Only solution seems to me is to set height of field "text" to very high number. But it will not look nice as there will be unnecessary space at the end of each file. IS there any solution so that height of field "text" is automatically adjust/resize according to the length of text file being imported?? So that height becomes small for smaller file and larger for larger files.
Thanks

-
jacque
- VIP Livecode Opensource Backer

- Posts: 7393
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Tue Apr 15, 2014 7:06 pm
Did you try setting the scroll of both the native scroller and the field to zero after you create the native scroller?
Code: Select all
mobileControlSet sScrollerId, "vscroll", 0
set the vScroll of field "textfield" to 0
Put that at the end after you have set all other scroller properties. You do need to delete the scroller before importing new text, and then re-create it afterward.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
saviour
- Posts: 26
- Joined: Wed Feb 05, 2014 5:11 am
Post
by saviour » Thu Apr 17, 2014 3:19 am
I have two card in my apps; one to import text while other has scroller in it. To import text, first card needs to be assessed everytime. So I thought below code in the second card delete the scroller everytime when the card is closed. Isn't it so ??
on closeCard
// Delete the scroller
if environment() is not "mobile" then exit closeCard
mobileControlDelete sScrollerID
end closeCard
-
Simon
- VIP Livecode Opensource Backer

- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
Post
by Simon » Thu Apr 17, 2014 5:36 am
Hi saviour,
I was having trouble understanding what you were trying to do so I built you a stack;
The key was;
Code: Select all
set the height of fld 1 of grp "scrollArea" to the formattedHeight of fld 1 of grp "scrollArea"
set the topLeft of fld 1 of grp "scrollArea" to the topLeft of grp "scrollArea"
which you will see on card 2
Did I get that right?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
saviour
- Posts: 26
- Joined: Wed Feb 05, 2014 5:11 am
Post
by saviour » Fri Apr 18, 2014 3:26 am
Hi Simon,
Thanks for your time. I was missing above code in my scripts. I will test and let you know

-
saviour
- Posts: 26
- Joined: Wed Feb 05, 2014 5:11 am
Post
by saviour » Fri Apr 18, 2014 5:15 am
Hi Simon,
Well now, I tested the stack in real device. For small text, there is no problem and it displays well in both cards any time. But for big text, the display result in card 2 (with native scroller) is different every time. Sometimes it displays and scroll well upto the full length of text. But many of times, I can't scroll down when a point is reached in the field and bottom line get hidden (like you can see in the screenshot) which is same problem I was facing earlier. I have tested with many different variations of codes but cannot solve this issue. I am rather confused that code "formatted height:" should adjust the field height according to the length of the text.
Thanks

-
Attachments
-

-
Simon
- VIP Livecode Opensource Backer

- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
Post
by Simon » Fri Apr 18, 2014 5:48 am
Here is the fix
Code: Select all
on closeCard
// Delete the scroller
if environment() is not "mobile" then exit closeCard
set the vScroll of group "scrollArea" to 0
mobileControlDelete sScrollerID
end closeCard
Simon
Edit;
Oh, and turn off the autoHilite of that fld.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!