-
Notifications
You must be signed in to change notification settings - Fork 19
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
Widget Operations #7
Conversation
Would it be possible to set the focus of a widget in the view? Just like setting the I do like the idea of IDs though, it would be ergonomic to be able to return a |
This is already possible by leveraging the Elm Architecture. All we would need is a "managed" implementation of the widgets (i.e. without any internal state).
The built-in focus operations will use the position of the widgets in the widget tree to pick the tab cycle order. However, it will be possible for users to build custom operations! |
Then why do these widget operations change the widget in the update, rather than staying consistent with the rest of the architecture and change the widget in the view? I worry that people will want to add more and more to the widget state, like storing the text of a button in the widget, until we are at a point where Iced is just like GTK etc where the state is broken up amongst the widgets, rather than being in the global state. |
@13r0ck It's unreasonable to ask users to handle every single widget interaction through the Elm Architecture. This would imply a message for every interaction. Imagine a Operations are only meant to be used to update internal widget state. Operations cannot update the structure of the widget tree, only |
Oh ok, I misunderstood your last message. Thank you for the clarification! :) I guess this is more of a port than a command then, right? Commands in both iced and Elm always return a message when completed. In ELM ports don't have the same guarantee. |
@13r0ck Commands are not guaranteed to return a message in both Elm and iced. In fact, ports produce commands. I believe you are thinking of |
0142bd8
to
2db077f
Compare
This proposal introduces the idea of widget operations in iced. A widget operation is defined as some logic that can traverse (and operate on) the widget tree of an iced application in order to query or update some widget state.
Rendered