3-way slider control
Paul Dupuis
paul at researchware.com
Wed May 26 13:28:55 EDT 2021
On 5/26/2021 12:16 PM, Curry Kenworthy via use-livecode wrote:
>
> Paul:
>
> > I created a slider with a label on the left and right in a group.
> > The slider is set to min 0, max 2, inc 1 and it's script is:
> > on scrollbarDrag pNewPosition
> > [...]
>
> I like this UI approach! Your script could be shorter.
> A 4-liner or 5-liner would be ideal; just eliminate the switch.
> (The current code is essentially repeating the same commands 3 times.)
>
What, like this:
on scrollbarDrag pNewPosition
local tToolTip = "CiC only,both CiC and Source,Source only"
set the thumbPosition of me to pNewPosition
set the tooltip of me to "Text style changes will be applied
to"&&(item pNewPosition+1 of tToolTip)
if pNewPosition=0 or pNewPosition=1 then enable fld "CiC_Label" else
disable fld "CiC_Label"
if pNewPosition=1 or pNewPosition=2 then enable fld "Src_Label" else
disable fld "Src_Label"
end scrollbarDrag
More information about the use-livecode
mailing list