It is currently April 25th, 2024, 11:43 am

Slider Confusion - Offset variable being weird [workaround found][solved]

Get help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Slider Confusion - Offset variable being weird [workaround found][solved]

Post by CodeCode »

Hello,
I have been working on a sliding app/link launcher. I expands to both left and right.

It seems to work fine, until a refresh. Then the OffSet variable goes off track and breaks the sliders (mostly - it is kind of weird).

I have attached the rmskin.

The action timer and variables are both at the top so seeing whats happening shouldn't be very cumbersome.

There are 2 variables #OffSetL# and #OffSetR#. Both seem to behave the same way.

I thought dividing the total slide width by the amount of pixels would have prevented this, but I am really not sure why the offset variables stop behaving as hoped - e.g. equal parts of a total of 140 pixels divided by the amount of 4 pixel steps (35).

Thanks for any help.
Expanded Launch_0.0.1.rmskin
The top 2 buttons control the left and right sliders.
You do not have the required permissions to view the files attached to this post.
Last edited by CodeCode on January 12th, 2022, 1:15 pm, edited 1 time in total.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Slider Confusion - Offset variable being weird

Post by CodeCode »

After some not thinking time, I came up with a working solution. It may not be the most eloquent solution, but it serves as a fix.

I added a logical OR to the IfCondition, likea dis:

Code: Select all

IfCondition=(#OffSetR# = -140) || (#OffSetR# <= -132)
IfTrueAction=[!SetVariable OffSetR "-140"][!SetOption Button4F LeftMouseUpAction """[!CommandMeasure MeasureSliderR "Stop 2"][!CommandMeasure MeasureSliderR "Execute 1"]"""][!SetOption BackgroundRight ImageName "#@#FrameBase.png"][!SetOption ButtonR3G Hidden "1"][!SetOption ButtonR3F Hidden "1"][!SetOption ButtonR3 Hidden "1"][!Update]
The IfTrueAction then force-sets the offset variable to the required -140 in the expanded position.

I will keep trying to break it, but so far it seems to be holding.
Maybe the Forum name should be appended to also say "and Place to Organise One's Thoughts" :lol:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.