Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread Poll:
Author: Subject: slider header

Posts: 1
Registered: 7/2/2008
Location: sf, ca
Member Is Offline
posted on 7/2/2008 at 09:32 PM Reply With Quote
slider header

Lets say I have a slider for 1-5 values. I want to have a header above the slider bar that says: 1 2 3 4 5 where each numeric label *exactly* matches the position of the actual slider knob for that value.

Is there any way to know with some kind of formula or something exactly where the slider's knob will "tick" into place?

I have several sliders of different scales that I want to do this for so I'd love to have some kind of algorithm I could use to generate the header but I can't figure out exactly what pixel position the slider knob is going to stop at for each value.

Also, would it be better to try and do this with an html table or just build a hardcoded image for the scale?
View User's Profile View All Posts By User U2U Member

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 7/3/2008 at 08:06 PM Reply With Quote

1. create the graphics for the slider's body with the notches and their labels. notches must be equally spaced. set n_controlWidth and n_controlHeight by the size of the image

2. set n_minValue, n_maxValue and n_step
(n_maxValue - n_minValue) must be multiple of n_step
Your graphics should have abs(n_maxValue - n_minValue) / n_step + 1 notches

3. set n_pathLeft and n_pathTop so the knob is right over the first notch when value is set to n_minValue (n_maxValue if b_reverse == true)

4. set n_pathLength so the knob is right over the last notch when value is set to n_maxValue (n_minValue if b_reverse == true)

the slider will make sure that it snaps the knob to the nearest notch in between.

If you need to generate different sliders dynamically you can generate the body of the control in HTML (with notches, labels etc), configure the script accordingly and position it over that body.
View User's Profile View All Posts By User U2U Member
Post new thread Poll:

Related Links:
Product Page
Product Demonstrations Live Demos
Traditional Blue
Scroll Bar
Master Volume
Events Handling
Product Documentation Documentation:
Documentation Page
Change Log
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart

Go To Top

Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004