Slider problem

I’ve got a slider with a valueBox label below it, and a button which sets the value of the slider when pressed.

All works well except when the user has changed the text in the valueBox, but not hit return to confirm the change. If they then press the button, the value in the valueBox ends up being the unconfirmed value, not the value applied by the button.

This happens because of a conflict between Slider::setValue(), and the valueBox’s TextEditor loosing focus. The TextEditor looses focus, and sends a message to the Slider. Before it’s received, the slider gets set to a new value by the button press. Then Slider::labelTextChanged() is called with the old, unconfirmed value, and the slider dutifully applies that to the valueBox, overriding the value set by the button.

I thought I could work around this by subclassing and changing Slider::setTextBoxIsEditable() so that the TextEditor would discard changes when it looses focus, rather than honoring them, but valueBox is a private member of the Slider class, so I can’t change any of it’s parameters when it’s created there.

Is there a way to deal with this problem?

Hmm. Just had a great idea - I think I’ll suggest to the phpBB developers that they should add a non-optional feature for all forums, so that whenever somebody tries to post a message containing the word “loose”, it makes them confirm that they really do mean it. And of course if a post contains the (non-existent) words “looses” or “loosing”, it could just be rejected.

…sorry, anyway, yes… back to the question… :wink:

Well, the reason it’s doing this is because the textbox uses an asyncupdater to deliver its change message, and like you say, the button is doing its job too soon.

I think it would make more sense in general for the text change to be delivered immediately, so I’m going to tweak it slightly to do that, but I can’t help feeling there must have been a good reason why I added that asyncupdater, so will have to keep a lookout for subtle problems there.

If you loose too much something, you’re going to lose it, anyway.

Jules, please give us a loose on this hard to understand concept…

Else, our minds won’t loosen from this specific task of welspeak (in newspeak).

[quote=“X-Ryl669”]If you loose too much something, you’re going to lose it, anyway.

Jules, please give us a loose on this hard to understand concept…

Else, our minds won’t loosen from this specific task of welspeak (in newspeak).[/quote]

Agh! I don’t know what it is about the loose/lose thing, but I find it the verbal equivalent of scraping your nails down a blackboard!

Hi! I don’t start a new thread, sorry (probably my problem is not a real trouble…) How to change the colour of Slider (LinearBar) caption? Slider compontent has a valueBox. How can I set the colour of this label?