-
Notifications
You must be signed in to change notification settings - Fork 35
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
An example without App.Simple
?
#96
Comments
An example that declaratively creates a «close» button:
|
I don't really have a general answer to this question... but personally I ended up forking gi-gtk-declarative and hacking a component system in - see: https://github.com/Dretch/gi-gtk-declarative I'd like to move the component system to a package that sits on-top of the regular gi-gtk-declarative, but so far I can't find a way around the |
I don't have any clean example of another architecture to share, unfortunately. https://github.com/owickstrom/komposition uses this library but with an indexed monad approach to stateful resources (GTK windows primarily). It's a bunch of (some mutually recursive) functions that create new windows and modals, patch the widget trees in them, and eventually destroys the resources they created. It's more advanced and I believe hard to generalize, but I would make sense with a simplified example. I haven't had time to extract it from Komposition, though. If anyone would like to have a stab it I think it would be a welcome contribution to the examples! |
By the way, there's an in-between approach that comes to mind, where you don't go all the way to indexed monads to ensure correct resource handling. You could just have values that represent windows/modals, and define create/update/destroy functions for such resources. I wrote about that style in Finite-State Machines, Part 2: Explicit Typed State Transitions. With Linear Haskell that could even be made safe, but it's not something I've fiddled with. |
I appreciate the experts sharing their advanced architectures with me and I would like to eventually explore them all. But at this time it would be hard for me to do so. I have not been working with GUI previously, so for me the question is more like «how to build up from first principles», rather than «how to get more power». I hardly even understand the basics, so it would be hard for me to appreciate the benefits of a finer architecture. Observe that any underlying imperative platform may be wrapped into the «update + view + state₀» idiom: Almost the same! So, while
For example, This is why I think it would be good to give an example of how the basic building blocks offered by P. S. I fixed the |
There are many great examples, but all of them use
App.Simple
. I would like to use some other architecture for my application. A simple example of opening a window with some buttons would go a long way. So far I have this:It works so far, but it took me something like 2 hours to get there! And it does not really use any features of
gi-gtk-declarative
because I could not figure out how to open a window yet.The text was updated successfully, but these errors were encountered: