Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slider call SetFloatValue without calling onValueChanged #72

Open
q-depot opened this issue Jul 17, 2013 · 5 comments
Open

slider call SetFloatValue without calling onValueChanged #72

q-depot opened this issue Jul 17, 2013 · 5 comments

Comments

@q-depot
Copy link

q-depot commented Jul 17, 2013

Hi,

I need to set the float value for a slider without calling the onValueChanged handler which should only be called when the value is set by the mouse click on the slider.
I looked at the Slider source code and this seems not possible without changing the SetFloatValue signature to allow an extra parameter "ignoreEvent" or something like that.
This would be my approach, but I want to double check if I'm the only one that needs this feature and if there is a work around with the current api.

thanks.

@Wizzard033
Copy link
Contributor

I recommend you add this functionality in to a fork.
Other controls have a doEvents boolean in their parameters that defaults to true.

@q-depot
Copy link
Author

q-depot commented Jul 18, 2013

would be nice to implement the same thing for all the controls, perhaps this should be in Controls::Base?

@Wizzard033
Copy link
Contributor

What? Why would all controls need to set a float value? Here is an example from Label.cpp :

void Label::SetText( const TextObject & str, bool bDoEvents )
{
    if ( m_Text->GetText() == str.GetUnicode() ) { return; }

    m_Text->SetString( str );
    Redraw();

    if ( bDoEvents )
    { OnTextChanged(); }
}

I think a lot of code encapsulation is violated by Gwen's design.
Even Base::SetValue( const TextObject & ) was not a good idea in opinion because not all controls have a string value.

@q-depot
Copy link
Author

q-depot commented Jul 18, 2013

I mean all the controls should have a variable to ignore the callback

@Wizzard033
Copy link
Contributor

I personally like the current way of just having a boolean on each function that may affect events that can be set to false to not do the event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants