LinearBar slider fails to set the cursor

Hi,
I have been facing problems with setting the mouse cursor for my Linear bar sliders. I can’t even guess what’s going wrong. Please can somebody help me out here.
Here is a piece of code that sets the mouse cursor but still when the UI turns up, the cursor i have set is no where to be seen.


juce::MouseCursor cursor(juce::MouseCursor::LeftRightResizeCursor);

_pCTracking = new juce::Slider(T("Tracking"));
_pCTracking->setSliderStyle( juce::Slider::LinearHorizontal) ;
_pCTracking->setTextBoxStyle( juce::Slider::NoTextBox , false , 0 , 0 ) ;
_pCTracking->setRange(-100.0,100.0,1.0);
_pCTracking->setValue(0.0, false);
_pCTracking->addListener(this);
_pCTracking->setMouseCursor( cursor );
_pCTracking->updateMouseCursor();
addAndMakeVisible(_pCTracking);

_pCTracking1 = new juce::Slider(T("Tracking1"));
//_pCTracking->getValueObject().referTo( _pCTracking1->getValueObject() ) ;
_pCTracking1->setRange(-100.0,100.0,1.0);
_pCTracking1->setValue(0.0,false);
_pCTracking1->setSliderStyle( juce::Slider::LinearBar) ;	
_pCTracking1->setInputRestriction( 3 , "-0123456789" ) ;
//_pCTracking1->setScrollWheelEnabled( false ) ;
_pCTracking1->setSliderSnapsToMousePosition( false ) ;
_pCTracking1->setMouseCursor( cursor );
_pCTracking1->updateMouseCursor();
_pCTracking1->addListener(this);
addAndMakeVisible(_pCTracking1);

The problem that i face here is when I try setting the cursor for linear horizontal sliders it works just fine,
but when I try to do the same for linear bar sliders its never sets it.

I’ll be grateful if someone can help, I am stuck up with this issue for quite sometime now.
Thanks

The linear bar style actually contains a big text label, so in fact your mouse is over the label, not the slider, and so it won’t show the slider’s cursor. I guess you could use LookAndFeel::createSliderTextBox to create a box with your custom cursor.

(BTW, please don’t use the T("") macro any more - it’s deprecated, and was a terrible idea in the first place!)

Thanks for the reply.
I was using that function already in my lookAndFeel but it never came to my mind to set the cursor for the label there. I would like to add that, even if I did not set the cursor for the label in that function, for some linear bar sliders which use the same lookAndFeel had the custom cursor coming up. I am still grateful that, your idea worked, but don’t you think it shouldn’t be that way.
Can you think of another possible work around? I feel that it’s not the problem’s solution.

I do agree that it could be better, although I’m not sure how I could easily do that… It’s an interesting point, I’ll ponder on it…

There is an interface already to set the Mouse Cursor for the TextBox of the Slider.

/**Sets mouse cursor for text box/label.
*/
void setMouseCursorForTextBox(const MouseCursor& cursor);

I guess this method is being used to set the mouse cursor for the label that the Slider uses internally. But I am sure that this is not working. I have tried it.
But setting the cursor for the label when its created in the lookAndfeel works fine.

…huh? That method doesn’t exist in my codebase. And judging by the lack of spaces, I certainly didn’t write it!

I am sorry to have replied so late. I was on a vacation. Also the function was added by a colleague here, in order to set the mouse cursor( but it did not work ), so apologies for that as well. Did you get a solution to the problem??

Yes, I realised that there should be a special type of cursor which means “use the parent component’s cursor”. I’ll add one shortly.