-
Notifications
You must be signed in to change notification settings - Fork 313
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
Format text input / transformation #701
Comments
With this code here I would be worried about what looks like a binding loop. When the value updates, there will be an event, which updates the value again, new event... The loop might be broken by that I believe it does not emit the change if it happens to have the same value. But in general I think such binding loops should be avoided. I think ideally we shouldn't emit change events when changing it programmatically, I believe that's how HTML works. But regardless, there is a sort of double-assignment here. If you want to respond to changes, you should rather use a |
Oh thank you for the help, it works. If someone needs something similar, here is the solution:
auto Value = Event.GetParameter<Rml::String>("value", "");
m_Input = String::FormatNumber(Value.c_str(), 2).ToString();
Model.DirtyVariable("input"); |
Reflecting a bit more on this one, I believe the initial issue here might have been a result of this one: #668 And the binding loop might be avoided altogether if we don't emit events when programmatically setting the value, as described here: #702 So all in all, when we address those suggested changes, the initial code here should hopefully work fine :) |
Is there anyway to use the format expression on text input?
I tried something like this, but didn't work:
Should I do this transformation entirely in C++? If so, what is the best way for that? I think to use
data-event-change
ordata-event-textinput
for that, although, I can't get the updated value from input (probably the handler is fired before the changes).The text was updated successfully, but these errors were encountered: