Icon on a slider
Klaus Major
kmajor at metascape.org
Thu Jun 13 10:41:02 EDT 2002
Hi Ron,
> The subject says it all...
>
> Is there a way to attach an icon to the sliding portion of a slider
> control?
yes it is. ;-)
> Thanks
> Ron
Oh, you sure want to know how to do it, do you ?!
OK, don't try Joshs advice.
Good idea, won't work unfortunately.
So you have to create a slider from scratch.
To start i will supply a script for an vertical slider.
Check it out, be happy, drop a line and i will supply one for a
horizontal, too.
Maybe you can figure it out on your own.
Here we go:
In my example i use a simple grc for the base (constrain) and a little
image
that acts as the actual sliding-knob with this script (in the image !)
local Scott_is_so_right
on mousedown
put true into Scott_is_so_right ## ;-)
## special insider joke...
end mousedown
on mouseup
put false into Scott_is_so_right ## that's not true ;-)
end mouseup
on mouserelease
put false into Scott_is_so_right
end mouserelease
on mousemove x,y
if Scott_is_so_right is not true then exit mousemove
## although this is very rarely the case ;-)
switch
case x < the left of grc 2
set the loc of me to item 1 of the loc of me, the top of grc 2
set the playloudness of player 1 to 0
break
case x > the right of grc 2
set the loc of me to item 1 of the loc of me, the top of grc 2
set the playloudness of player 1 to 100
break
default
set the loc of me to x, item 2 of the loc of me
set the playloudness of player 1 to round((x - the left of grc
2)/(the width of grc 2)*100)
break
end switch
end if
end mousemove
Of course you can take another image for the base, so you can create
really beautiful sliders, even with animated gifs...
Check this out and have fun...
Regards
Klaus Major
kmajor at metascape.org
More information about the use-livecode
mailing list