scrollable-touch field
Posted: 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!
Thanks!
Questions and answers about the LiveCode platform.
https://www.forums.livecode.com/
Klaus wrote: ↑Tue Jan 18, 2022 11:33 amhttps://lessons.livecode.com/m/4069/l/9 ... ll-a-field
And more here:
https://lessons.livecode.com/m/4069
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
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
...
Nooooo!Klaus wrote: ↑Tue Feb 01, 2022 5:01 pmyou have been hit by an ugly bug: https://quality.livecode.com/show_bug.cgi?id=23177
alright thanks, i will try, but since the content of my field changes all the time (becomes more) does it help to add pixels?
Klaus wrote: ↑Tue Feb 01, 2022 5:01 pmyou have been hit by an ugly bug: https://quality.livecode.com/show_bug.cgi?id=23177
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?Klaus wrote: ↑Tue Feb 01, 2022 5:01 pmHi 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:Try with different values.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 ...
Best
Klaus
Code: Select all
put 0,0, the formattedWidth of field "ProvaData", the formattedHeight of field "ProvaData" into tContentRect