Posted by member 99 on 2003-11-14 13:15:02 link
SliderStepsX 4
SliderStepsY 1
SliderStep1Cmd '!alert "Position 1"'
SliderStep2Cmd '!alert "Position 2"'
SliderStep3Cmd '!alert "Position 3"'
SliderStep4Cmd '!alert "Position 4"'
SliderWaitForRelease true
SliderWidth 96
SliderHeight 0
SliderHandleWidth 16
SliderHandleHeight 16
SliderPaddingX 8
SliderPaddingY 8
; ----------
*skinbox SliderBox
SliderBoxWidth $SliderWidth+2*SliderPaddingX+SliderHandleWidth$
SliderBoxHeight $SliderHeight+2*SliderPaddingY+SliderHandleHeight$
*script bang !SliderInit
*script exec !SkinBoxOnTop %{\1} false
*script exec !SkinBoxExec %{\1} !SkinBoxLoadBoxHook "name=%{\2}" ":" {@ih}
*script exec !SkinBoxAction %{\2} LButtonDown !SliderBeginDrag %{\2} %{\1}
*script exec !SkinBoxAction %{\2} LButtonUp !SliderEndDrag %{\2}
*script exec !SkinBoxMove %{\2} $SliderPaddingX$ $SliderPaddingY$
*script ~bang
*script bang !SliderBeginDrag
*script exec !SkinBoxAction %{\1} MouseMove !SliderDragTo {@in} %{\2} {@mxs} {@mys}
*script ~bang
*script bang !SliderEndDrag
*script gotoif ("$SliderWaitForRelease$" = "false") SliderEndDragFinish
*script exec !SkinBoxExec %{\1} {SliderStep%{SliderStep}Cmd}
*script label SliderEndDragFinish
*script exec !SkinBoxAction %{\1} MouseMove
*script ~bang
SliderStepXSize $SliderWidth/(SliderStepsX-1)$
SliderStepYSize $SliderHeight/(SliderStepsY-1)$
SliderStepXShift $SliderStepXSize/2-SliderPaddingX$
SliderStepYShift $SliderStepYSize/2-SliderPaddingY$
*script bang !SliderDragTo
*script exec !SkinBoxExec %{\2} !varSet SliderStepX \d(%{\3}-{@ix}+SliderStepXShift)/SliderStepXSize\d
*script gotoif ("%{SliderStepX}" = "0") NoClipXBottom
*script exec !varSet SliderStepX 0
*script label NoClipXBottom
*script exec !SkinBoxExec %{\2} !varSet SliderStepY \d(%{\4}-{@iy}+SliderStepYShift)/SliderStepYSize\d
*script gotoif ("%{SliderStepY}" = "0") NoClipYBottom
*script exec !varSet SliderStepY 0
*script label NoClipYBottom
*script exec !SkinBoxExec . !varSet SliderStep \d%{SliderStepX}+%{SliderStepY}*SliderStepsX+1\d
*script gotoif ("$SliderWaitForRelease$" = "true") SliderDragToWait
*script exec !SkinBoxExec %{\1} "\dSliderStep%{SliderStep}Cmd\d"
*script label SliderDragToWait
*script exec !SkinBoxExec . !varSet SliderHandleX \d%{SliderStepX}*SliderStepXSize+SliderPaddingX\d
*script exec !SkinBoxExec . !varSet SliderHandleY \d%{SliderStepY}*SliderStepYSize+SliderPaddingY\d
*script exec !SkinBoxExec . !SkinBoxMove %{\1} %{SliderHandleX} %{SliderHandleY}
*script ~bang
*script start !SliderInit SliderBox SliderHandle
There seems to be a bug in drawing with colors when using the boxhook, but otherwise this works.
SliderStepsY 1
SliderStep1Cmd '!alert "Position 1"'
SliderStep2Cmd '!alert "Position 2"'
SliderStep3Cmd '!alert "Position 3"'
SliderStep4Cmd '!alert "Position 4"'
SliderWaitForRelease true
SliderWidth 96
SliderHeight 0
SliderHandleWidth 16
SliderHandleHeight 16
SliderPaddingX 8
SliderPaddingY 8
; ----------
*skinbox SliderBox
SliderBoxWidth $SliderWidth+2*SliderPaddingX+SliderHandleWidth$
SliderBoxHeight $SliderHeight+2*SliderPaddingY+SliderHandleHeight$
*script bang !SliderInit
*script exec !SkinBoxOnTop %{\1} false
*script exec !SkinBoxExec %{\1} !SkinBoxLoadBoxHook "name=%{\2}" ":" {@ih}
*script exec !SkinBoxAction %{\2} LButtonDown !SliderBeginDrag %{\2} %{\1}
*script exec !SkinBoxAction %{\2} LButtonUp !SliderEndDrag %{\2}
*script exec !SkinBoxMove %{\2} $SliderPaddingX$ $SliderPaddingY$
*script ~bang
*script bang !SliderBeginDrag
*script exec !SkinBoxAction %{\1} MouseMove !SliderDragTo {@in} %{\2} {@mxs} {@mys}
*script ~bang
*script bang !SliderEndDrag
*script gotoif ("$SliderWaitForRelease$" = "false") SliderEndDragFinish
*script exec !SkinBoxExec %{\1} {SliderStep%{SliderStep}Cmd}
*script label SliderEndDragFinish
*script exec !SkinBoxAction %{\1} MouseMove
*script ~bang
SliderStepXSize $SliderWidth/(SliderStepsX-1)$
SliderStepYSize $SliderHeight/(SliderStepsY-1)$
SliderStepXShift $SliderStepXSize/2-SliderPaddingX$
SliderStepYShift $SliderStepYSize/2-SliderPaddingY$
*script bang !SliderDragTo
*script exec !SkinBoxExec %{\2} !varSet SliderStepX \d(%{\3}-{@ix}+SliderStepXShift)/SliderStepXSize\d
*script gotoif ("%{SliderStepX}" = "0") NoClipXBottom
*script exec !varSet SliderStepX 0
*script label NoClipXBottom
*script exec !SkinBoxExec %{\2} !varSet SliderStepY \d(%{\4}-{@iy}+SliderStepYShift)/SliderStepYSize\d
*script gotoif ("%{SliderStepY}" = "0") NoClipYBottom
*script exec !varSet SliderStepY 0
*script label NoClipYBottom
*script exec !SkinBoxExec . !varSet SliderStep \d%{SliderStepX}+%{SliderStepY}*SliderStepsX+1\d
*script gotoif ("$SliderWaitForRelease$" = "true") SliderDragToWait
*script exec !SkinBoxExec %{\1} "\dSliderStep%{SliderStep}Cmd\d"
*script label SliderDragToWait
*script exec !SkinBoxExec . !varSet SliderHandleX \d%{SliderStepX}*SliderStepXSize+SliderPaddingX\d
*script exec !SkinBoxExec . !varSet SliderHandleY \d%{SliderStepY}*SliderStepYSize+SliderPaddingY\d
*script exec !SkinBoxExec . !SkinBoxMove %{\1} %{SliderHandleX} %{SliderHandleY}
*script ~bang
*script start !SliderInit SliderBox SliderHandle