-
Notifications
You must be signed in to change notification settings - Fork 543
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
Allow two-way binding to struct members #814
Comments
I have been thinking allowing two way binding with converstion.
(then implementation wise, in the generated code, there would be in the impl Property pub fn link_two_way_with_conversion(prop1: Pin<&Property<T>>, prop2: Pin<&Property<U>>, conv1: impl Fn(U)->T, conv2: impl Fn(T)->U) ) But unfortunately this is not enough because
cannot be inverted.... pub fn link_two_way_with_conversion(prop1: Pin<&Property<T>>, prop2: Pin<&Property<U>>, conv1: impl Fn(U, &T)->T, conv2: impl Fn(T, &U)->U) |
Since it's structs (aka product types) you're dealing with, you can always inline them. That is, it's always possible to compile this:
into that:
Then rewrite reads and writes of |
It is currently only possible to bind a current-value or checked attribute of a widget to a property. This requires creating single properties for each control in order to process their value in the host application or to create a struct and manually fill the values in a .60 callback.
It would be convenient to be able to map attributes to members of a struct property, like:
The text was updated successfully, but these errors were encountered: