scrollable-touch field

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

Post Reply
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

scrollable-touch field

Post by Samuele » Mon Jan 17, 2022 11:57 pm

Hi, is there a way to ,make a table field, scrollable? but not with the scrollbar, but just by scrolling down or up (I'm talking for mobile obviously)
Thanks!
Samuele.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: scrollable-touch field

Post by Klaus » Tue Jan 18, 2022 11:33 am


Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: scrollable-touch field

Post by Samuele » Tue Jan 18, 2022 11:48 am

Samuele.

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: scrollable-touch field

Post by Samuele » Tue Feb 01, 2022 4:51 pm

Hi I tried this script for a scrollable-touch field on android, it works, but not all the content of the field can be seen, after, you scroll a bit down, it ends the scrolling, before all the content is shown, was I understandable? :roll:

Code: Select all

//Scroller

on preOpenCard
   local tScrollerRect, tContentRect
   
   // Only create a scroller on a mobile device
   if environment() is not "mobile" then exit preOpenCard
   
   // Set the area of the scroller
   put the rect of group "scrollArea" into tScrollerRect
   
   // Set the are of the content to be scrolled
   put the left of field "ProvaData",the top of field "ProvaData",the right of field "ProvaData",the formattedHeight of field "ProvaData" into tContentRect
   
   // Create the scroller control
   mobileControlCreate "scroller", "RankScroll"
   
   // Set the properties of the scroller
   mobileControlSet "RankScroll", "rect", tScrollerRect
   mobileControlSet "RankScroll", "contentRect", tContentRect
   mobileControlSet "RankScroll", "visible", true
   mobileControlSet "RankScroll", "scrollingEnabled", true
   mobileControlSet "RankScroll", "vIndicator", true
   mobileControlSet "RankScroll", "vscroll", 0
end preOpenCard

on closeCard
   // Delete the scroller
   if environment() is not "mobile" then exit closeCard
   mobileControlDelete "RankScroll"
end closeCard

on scrollerDidScroll hOffset, vOffset
   // When the user scrolls move the displayed content
   set the vScroll of group "scrollArea" to vOffset
end scrollerDidScroll
Thanks!
Samuele.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: scrollable-touch field

Post by Klaus » Tue Feb 01, 2022 5:01 pm

Hi Samuele,

you have been hit by an ugly bug: https://quality.livecode.com/show_bug.cgi?id=23177
As a workaround try to add some pixels to the (formatted)height like this:

Code: Select all

...
// Set the are of the content to be scrolled
put the left of field "ProvaData",the top of field "ProvaData",the right of field "ProvaData",(the formattedHeight of field "ProvaData" + 20) into tContentRect
...
Try with different values.


Best

Klaus

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: scrollable-touch field

Post by Samuele » Tue Feb 01, 2022 5:53 pm

Klaus wrote:
Tue Feb 01, 2022 5:01 pm
you have been hit by an ugly bug: https://quality.livecode.com/show_bug.cgi?id=23177
Nooooo!
Klaus wrote:
Tue Feb 01, 2022 5:01 pm
As a workaround try to add some pixels to the (formatted)height like this:
alright thanks, i will try, but since the content of my field changes all the time (becomes more) does it help to add pixels?
Samuele.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: scrollable-touch field

Post by Klaus » Tue Feb 01, 2022 6:09 pm

No general solution, you will need to experiment a bit...

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: scrollable-touch field

Post by stam » Tue Feb 01, 2022 7:43 pm

Klaus wrote:
Tue Feb 01, 2022 5:01 pm
you have been hit by an ugly bug: https://quality.livecode.com/show_bug.cgi?id=23177


I noticed this in your bug report:
klaus.jpg
I'm more surprised you bought your first mobile cellphone in April 2021!!!! ;) ;) ;)

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: scrollable-touch field

Post by Klaus » Tue Feb 01, 2022 7:46 pm

Yo, and still have no SIM card! :-D

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: scrollable-touch field

Post by stam » Tue Feb 01, 2022 9:48 pm

Klaus wrote:
Tue Feb 01, 2022 7:46 pm
Yo, and still have no SIM card! :-D
You’re my hero!!

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: scrollable-touch field

Post by Samuele » Tue Feb 01, 2022 10:54 pm

Klaus wrote:
Tue Feb 01, 2022 5:01 pm
Hi Samuele,

you have been hit by an ugly bug: https://quality.livecode.com/show_bug.cgi?id=23177
As a workaround try to add some pixels to the (formatted)height like this:

Code: Select all

...
// Set the are of the content to be scrolled
put the left of field "ProvaData",the top of field "ProvaData",the right of field "ProvaData",(the formattedHeight of field "ProvaData" + 20) into tContentRect
...
Try with different values.


Best

Klaus
nooooo, i tried with this change and it remains exactly the same, meaning the field stops at the same point it stopped before the +, do i need to set something to the field or change something else maybe?
Thanks!
Samuele.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: scrollable-touch field

Post by bn » Wed Feb 02, 2022 11:24 am

Samuele,

could you try to set the topLeft of the contentRect to 0,0

like recommended in the first lesson Klaus pointed to

Code: Select all

put 0,0, the formattedWidth of field  "ProvaData", the formattedHeight of field "ProvaData" into tContentRect
Kind regards
Bernd

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

Re: scrollable-touch field

Post by jacque » Wed Feb 02, 2022 6:54 pm

Also, every time the field content changes you need to delete the old scroller and create a new one. If you don't want to do that you can try just changing the contentRect but I've found it easier to just start again with a fresh scroller. If you don't do that you'll also need to add more code to adjust the content alignment.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”