Slithery sliders

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
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 7217
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Slithery sliders

Post by richmond62 » Tue May 25, 2021 7:16 pm

Over on the Use-list there is a thread currently running about a 3-way slder control.

I read that and got distracted by this:

"I was imagining more of the common "circle inside an oval" "switch" control you see on the web and in apps these days."

Then got myself in serious trouble with this:
-
SShot 2021-05-25 at 21.13.53.png
-
SShot 2021-05-25 at 21.08.44.png
-
Not perfect by a long, long way, but certainly a start.
Attachments
SLIDER.livecode.zip
Here's the stack.
(19.13 KiB) Downloaded 81 times

paul@researchware.com
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 82
Joined: Wed Aug 26, 2009 7:42 pm
Location: Randolph, MA USA
Contact:

Re: Slithery sliders

Post by paul@researchware.com » Tue May 25, 2021 8:41 pm

That's very slick Richmond, and I'm glad the thread inspired something. This google search illustrates what I was originally looking for (while there are some exceptions in the images that come up, most are on-off 2-position switches that are a "thumb" (often circular) in a oval or rectangular "switch")

https://www.google.com/search?q=sliding ... 0&biw=1920
Paul Dupuis
ResearchWare, Inc.

seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Re: Slithery sliders

Post by seaniepie » Thu May 27, 2021 4:21 am

I've made a multiway switch. It's not perfect but is most the way there.

Screenshot 2021-05-27 at 04.13.41.png
Screenshot 2021-05-27 at 04.13.41.png (15.75 KiB) Viewed 1456 times

Resize the group by drag or script to resize the switch.
Look at the custom properties to change the number of positions and its current position. Also for changing the colours used.
At runtime, dragging the button slides it up and down and releasing snaps it to the nearest switch position.

Enjoy
Attachments
MultiWaySwitch.livecode.zip
MultiWaySwitch for livecode
(1.74 KiB) Downloaded 77 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 7217
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Slithery sliders

Post by richmond62 » Thu May 27, 2021 8:29 am

That's groovy, but it has no "Blip".

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

Re: Slithery sliders

Post by jmburnod » Thu May 27, 2021 9:49 am

Hi seaniepie,
Thanks you for share
I get an error if i dont resize group MultiWaySwitch.
numeric: divide by zero
Object MultiWaySwitch
Line put round((tX - sPropsA["pos1"]) / sPropsA["div"]),sPropsA["div"],sPropsA["range"],sPropsA["pos1"]
Hint btnRelease
I added an opencard message to avoid this

Code: Select all

on opencard
   send resizeControl to grp "MultiWaySwitch"
end opencard
Best regards
Jean-Marc
https://alternatic.ch

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”