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

Implement property to property mapping #53

Open
SamRodri opened this issue Apr 9, 2024 · 0 comments
Open

Implement property to property mapping #53

SamRodri opened this issue Apr 9, 2024 · 0 comments
Labels
A-macro Area: Macros todo TODO task

Comments

@SamRodri
Copy link
Collaborator

SamRodri commented Apr 9, 2024

In widget macros, implement mapping a property value to another property in the same widget using the expr_var syntax.

#[widget($crate::foo)]
pub mod foo {
    properties! {
        a_property;

        /// This property is set only when `a_property` has a value and it is a mapping of the a_property.
        b_property = 1 + #a_property + 3;

        /// This property is set only when `a_property` is and it is a mapping of the a_property.
        on_prop = hn!(#a_property, |_| {
            println!(a_property.get());
        });
    }
}
  • How does this integrate with when?
    • Not allowed in when assigns?
    • In the example above a_property is affected by when in the handler.
  • Use cases:
    • Border color depend on background color with when only assigning background.
@SamRodri SamRodri added todo TODO task A-macro Area: Macros labels Apr 9, 2024
@SamRodri SamRodri changed the title Implement in property to property mapping Implement property to property mapping Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro Area: Macros todo TODO task
Projects
None yet
Development

No branches or pull requests

1 participant