Hi,
How could I ignore the mouse if it's not over the thumb?
So far I have tried to get the relative mouseXY coordenates within the slider, and the physical?? position of the slider regarding the actual value in sliderDragStarted method, and then tried to compared them having into account my thumb bounds as offset.
And trying to use fader->setEnabled(false) to ignore the dragging activity.
And fader->setEnabled(true) to enable the slider again within sliderDragDragEnd or sliderstoppedDragging, but I never get these callbacks called :(. EDIT: yes, i can enable the slider again by using: void MainContentComponent::sliderDragEnded(Slider* sliderThatWasMoved). I would like to know how to get the others called anyway ;D
Even using setenable(false) the textbox is disable visually, don't like that....
Is it a very rude way to performance this tasK...I am not a juce expert
, i would appreciate any help with these, since i think it is a important feature for real time applications.
void MainContentComponent::sliderDragStarted(Slider* sliderThatWasMoved)
{
unsigned int value = 0;
float pos;
unigned faderXoffset = 0; faderYoffset = 0;
if (sliderThatWasMoved == fader1)
{
Point<int> p(fader1->getMouseXYRelative()); //getXY coordenates
offsetY= fader1->getHeight()/2; //thumb height /2 as offset
pos = fader1->getPositionOfValue(fader1->getValue()); //Relative position of the fader regarding the actual value
if (p.getY()>(pos+Yoffset) || (p.getY<pos-Yoffset)) //if is mouse is not clicked within thumb bounds...
fader1->setEnabled(false); //disable fader
}
void MainContentComponent::sliderDragDragEnd(Slider* sliderThatWasMoved)
{
fader1->setEnabled(true);
}
void MainContentComponent::sliderstoppedDragging(Slider* sliderThatWasMoved)
{
fader1->setEnabled(true);
}
Any idea also about the half vanished thumb in the bottom??
Regards
Carlos