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

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to