Click to See Complete Forum and Search --> : Vertical slider control


shalinicodeguru
May 4th, 2007, 02:34 AM
Hi,
i am creating one volume control in mFC application and i want to create one Vertical slider control but there is one problem in vertical slider control actually when i press the thumb of vertical slider control to down value increases and when i scroll to up value decreases i wnt to do this in opposite direction. i want to do this vertical slider as i want to scroll up to increase vaue and down to decrease value..

Please help me..

Thanks in advance.

JohnW@Wessex
May 4th, 2007, 04:07 AM
After reading the volume control, subtract the value from the maximum value.

i.e.
If the range is 0-100

Upside down volume control returns 75.
Real value = 100 - 75 = 25

shalinicodeguru
May 4th, 2007, 04:18 AM
Can u explain by an example so that i can implement this in my code i dont know where i have to put it actually i do not derive any class from this slider control so and i am using like:

CSliderCtrl m_ctrlSlider;

where to do this means upside down.....

Thanks....

JohnW@Wessex
May 4th, 2007, 07:43 AM
The bottom of the slider gives you the maximum value.
The top of the slider gives you the minimum value.
This is 'upside down' to what most people would expect.

Assuming you have set the range to 0-100...

When the slider is at the bottom you will get 100 from m_ctrlSlider.GetPos(). What you want is 0, so subtract the value (100) from the maximum (100) to get the value you desire (0)

The same goes for all other values returned from GetPos.
const int MAX_VOLUME = 100;

int volume = MAX_VOLUME - m_ctrlSlider.GetPos();
The value of 'volume' will be 0 at the bottom of the slider and 100 at the top.