Drawing a line between multiple slider 'thumbs'

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

calmrr3
Posts: 100
Joined: Mon Oct 28, 2013 2:39 pm

Re: Drawing a line between multiple slider 'thumbs'

Post by calmrr3 » Tue Nov 05, 2013 10:42 pm

calmrr3 wrote:

Code: Select all

on scrollbardrag tThumbPos
     set the blendlevel of img "strip1" to tThumbPos/7
   set the points of graphic "line1" to 90,the thumbpos of scrollbar "scrollbar1" +20 & return & 130,the thumbpos of scrollbar "scrollbar2"+20
end scrollbardrag
This seems to work, although the line only moves in real time with the thumb of scroll bar 1, when I move the thumb of scrollbar 2 the line only moves (jumps) into position on mouseUp
Sorted it, just applied

Code: Select all

 set the points of graphic "line1" to 90,the thumbpos of scrollbar "scrollbar1" +20 & return & 130,the thumbpos of scrollbar "scrollbar2"+20
to the script of scrollbar2

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Drawing a line between multiple slider 'thumbs'

Post by dunbarx » Wed Nov 06, 2013 12:10 am

Nicely done.

Can you rewrite this using a repeat loop that finds each thumbposition of the 20 and sets the points accordingly? That way the whole shebang can be done in a handful of lines of code.

Look up the "repeat with counter = startValue [to | down to] endValue" form of the repeat control structure. I know you can do this.

Craig

Post Reply