Hi everyone,
I have an slider its value is from 0 to 23 for hours.
I want its value to be shown as 00:00 to 23:00 when 'Show Value' is set. (Minutes are always :00 .)
The usual 'Value Format', as I have read from examples and livecode wiki, formats this number as a floating point number with specified decimal places/leading zeros.
Thanks a lot for your help.
advanced format for slider value
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: advanced format for slider value
Hi.
This is not perfect. Maybe it can be made so. Before you start, go to the inspector and set the valueFormat to ".00". Then in the slider script:
Is this OK?
Craig Newman
This is not perfect. Maybe it can be made so. Before you start, go to the inspector and set the valueFormat to ".00". Then in the slider script:
Code: Select all
on scrollbarDrag
set the thumbPos of me to round(the thumbPos of me,0)
end scrollbarDrag
Craig Newman
Re: advanced format for slider value
Thanks Craig,
I got 12.00 instead of 12:00, as you pointed out "It is not perfect".
Another problem is that the slider loses its smooth movement and jumps between round number.
I got 12.00 instead of 12:00, as you pointed out "It is not perfect".
Another problem is that the slider loses its smooth movement and jumps between round number.

Re: advanced format for slider value
Then you have to make a workaround. In this case we call it a kluge.
Create a field of nice size and proportion that will overlie the numeric part of the slider. Have that field track the thumb (or rather, vice-versa). Use the mouseMove or mouseStillDown message in the field to load that field with the rounded value of the slider. Or do the math yourself and simply hide the position display. Now you never set the thumbPosition, so the smoothness will return. And you can format the field value in any way you like.
OK with this? You will have to scale the X coordinates to make sense of it all, something the thumbPos does for you.
Craig
Create a field of nice size and proportion that will overlie the numeric part of the slider. Have that field track the thumb (or rather, vice-versa). Use the mouseMove or mouseStillDown message in the field to load that field with the rounded value of the slider. Or do the math yourself and simply hide the position display. Now you never set the thumbPosition, so the smoothness will return. And you can format the field value in any way you like.
OK with this? You will have to scale the X coordinates to make sense of it all, something the thumbPos does for you.
Craig
Re: advanced format for slider value
Thanks Craig,
Yes, it works and it provides me with the functionality I need.
Thank you a lot for your kindness and spending your time.
My project is on mobile phone and I should check processing power of my mobile.
I have eight sliders working at same time.
I have already encountered the problem that everything is OK on PC but the processing power of mobile is not enough. It doesn't seem heavy calculation and I guess it works. I will check it.
Yes, it works and it provides me with the functionality I need.
Thank you a lot for your kindness and spending your time.
My project is on mobile phone and I should check processing power of my mobile.
I have eight sliders working at same time.
I have already encountered the problem that everything is OK on PC but the processing power of mobile is not enough. It doesn't seem heavy calculation and I guess it works. I will check it.