Replies: 1 comment
-
Most callbacks are not If you don't care about this, there are tricks using interior mutability. A few macros are defined in cursive to make this convenient to use: for example
In a different direction, it's also possible to write custom views that are most friendly to MVC configurations. It may include storing the content in a shared data structure. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
how can I do data binding using cursive, for example if I have
struct Content {
content1: String,
content2: String,
content3: String
}
and create one text area for each content. I want the data and the ui be in sync?
textarea can't hold a mutable reference to a piece of content, and in textarea's callback function, we don't allow to mutate values from outside (it's not FnMut).
I don't know what to do here?
In the official tutorial_3, the above situation is not covered (https://github.com/gyscos/cursive/blob/main/doc/tutorial_3.md)
as the tutorial only shows how to mutate the cursive ui struct itself.
however, in a model-view-controller setup, the data is not held directly by the ui. In this case, I don't know how to update the data given the callback function isn't FnMut?
Beta Was this translation helpful? Give feedback.
All reactions