Custom scrollbar
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 39
- Joined: Thu Jan 23, 2020 5:56 pm
Custom scrollbar
Hi guys,
Can you help me create a custom scrollbar? I tried following this site - http://lessons.livecode.com/m/4071/l/22 ... m-controls
but I don't understand how should I connect between the scrollbar and the field that I want the user to scroll at.
thank you
Can you help me create a custom scrollbar? I tried following this site - http://lessons.livecode.com/m/4071/l/22 ... m-controls
but I don't understand how should I connect between the scrollbar and the field that I want the user to scroll at.
thank you
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Custom scrollbar
Hi.
Certainly we can help. But what do you want your custom control to do that the regular one cannot? I only glanced at the lesson you posted, so I do not know what
What does a field have to do with a scrollbar, however it is constructed? I suspect there might be a simpler way to do what you intend, even though making such a gadget would still be a great learning experience in its own right.
Craig
Certainly we can help. But what do you want your custom control to do that the regular one cannot? I only glanced at the lesson you posted, so I do not know what
means.the field that I want the user to scroll at
What does a field have to do with a scrollbar, however it is constructed? I suspect there might be a simpler way to do what you intend, even though making such a gadget would still be a great learning experience in its own right.
Craig
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Custom scrollbar
Here is a standard text field with an inbuilt vertical scrollbar.
-
- Posts: 39
- Joined: Thu Jan 23, 2020 5:56 pm
Re: Custom scrollbar
dunbarx wrote: ↑Mon Jun 29, 2020 2:06 pmHi.
Certainly we can help. But what do you want your custom control to do that the regular one cannot? I only glanced at the lesson you posted, so I do not know whatmeans.the field that I want the user to scroll at
What does a field have to do with a scrollbar, however it is constructed? I suspect there might be a simpler way to do what you intend, even though making such a gadget would still be a great learning experience in its own right.
Craig
I am developing an app currently and the inbuilt scrollbar doesn't look good enough in android, but in IOS it looks pretty good.
I want to make the scrollbar in android look good as the one that in IOS.
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Custom scrollbar
Fair enough. I do not develop for mobile, so I cannot help there at all. But you will have to assemble and evaluate various controls and images first, to see how they look, before you need create a working custom control.
Let us know when you have it all the way you want it. Making the actual gadget is straightforward.
Craig
Let us know when you have it all the way you want it. Making the actual gadget is straightforward.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 7230
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Custom scrollbar
Mobile apps do not use scrollbars on either iOS or Android. Users expect to swipe field content, which you can do using mobileControlCreate to create a scroller overlay and mobileControlSet to assign its behavior.I want to make the scrollbar in android look good as the one that in IOS.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Custom scrollbar
Hi,
the lesson you looked at is for custom controls, it is not what you are looking for. As others have pointed out, you need to look at mobileControlCreate. Here is some sample code, you would most likely run it on the card script. When you leave the card you want to delete the scroller, otherwise it might mess up your interface on the next card. ask if you need more info. There are also some livecode lessons out there: http://lessons.livecode.com/m/4069/l/94 ... ll-a-field When I used it the first time it felt rather cumbersome, but I somehow got used to it, still it feels like a workaround for me and a more streamlined way of doing it would be appreciated.
the lesson you looked at is for custom controls, it is not what you are looking for. As others have pointed out, you need to look at mobileControlCreate. Here is some sample code, you would most likely run it on the card script. When you leave the card you want to delete the scroller, otherwise it might mess up your interface on the next card. ask if you need more info. There are also some livecode lessons out there: http://lessons.livecode.com/m/4069/l/94 ... ll-a-field
Code: Select all
on opencard
-- create native scroller
if environment() is "mobile" then
// Set the area of the scroller
put the rect of group "steplist" into tempscrollerrect
// Create the scroller control
mobileControlCreate "scroller", "steplist"
// Set the properties of the scroller
mobileControlSet "steplist", "rect", tempscrollerrect
mobileControlSet "steplist", "contentRect", tempscrollerrect
mobileControlSet "steplist", "visible", true
mobileControlSet "steplist", "scrollingEnabled", true
mobileControlSet "steplist", "vIndicator", true
mobileControlSet "steplist", "hIndicator", false
mobileControlSet "steplist", "vscroll", 0
end if
end opencard
on scrollerDidScroll hOffset, vOffset
// When the user scrolls move the displayed content
set the vScroll of group "steplist" to vOffset
end scrollerDidScroll
-
- VIP Livecode Opensource Backer
- Posts: 7230
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Custom scrollbar
Code: Select all
mobileControlSet "steplist", "rect", tempscrollerrect
mobileControlSet "steplist", "contentRect", tempscrollerrect
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Custom scrollbar
In your original post you mentioned a LC lesson. I have not explored it and this may have been included in the lesson. If you have not found Marty's Sliders, let me know and I will upload it here.
Linda
Linda
Re: Custom scrollbar
You are right,the sample code above doesnt yet make anything scroll. I posted this just to give the OP an indication how to set up a mobile scroller. In my case I set the contentrect later on dynamically when the user adds objects to my "steplist" group. And I use the formattedHeight of the group "steplist" to set the contentrect.jacque wrote: ↑Sun Jul 05, 2020 9:27 pmDoes this scroll? Usually the contentRect is taller than the group and uses the formattedHeight of the group.Code: Select all
mobileControlSet "steplist", "rect", tempscrollerrect mobileControlSet "steplist", "contentRect", tempscrollerrect
Best
Oliver