Hello,
I have been trying to create a Goa project from the Dialog Test component, but I'm bumping into the limits of my Genode abilities.
I'm trying to use "dialog.run" as a template for what to include, using the "import_from_depot" section as a rough guide to "used_apis" and the config for the "runtime" file.
1. Is this the right basic idea?
2. Is there already a minimal example of a Goa project for a Nitpicker and/or Dialog API component, so I don't have to reinvent the wheel?
3. I have tried various combinations of depot packages, but the compiler can't find "dialog/runtime.h". Is the Dialog API exposed in a depot package, and if so, which one? I have tried various potential candidates (e.g., "pkg/gems", "pkg/nitpicker_session", "src/nitpicker", etc. ), but without success.
Thanks and Happy Sculpting!
Hi John,
I have been trying to create a Goa project from the Dialog Test component, but I'm bumping into the limits of my Genode abilities.
I'm trying to use "dialog.run" as a template for what to include, using the "import_from_depot" section as a rough guide to "used_apis" and the config for the "runtime" file.
thanks for your interest in the dialog API. So far, the API has only been used by the Sculpt manager and the file vault, both of which being hosted in Genode's main repository and accessing the API via a static library. To make the API usable for Goa projects, an ABI-symbols definition and proper depot archives are needed. Commit [1] adds these prerequisites.
[1] https://github.com/genodelabs/genode/issues/5409
I just published the resulting archives for Sculpt 24.10 under my name.
https://depot.genode.org/nfeske/api/dialog/ https://depot.genode.org/nfeske/src/dialog/ https://depot.genode.org/nfeske/bin/x86_64/dialog/ https://depot.genode.org/nfeske/bin/arm_v8a/dialog/
With these archives publicly available, the API can be accessed from a Goa project. I took the route you suggested and took a copy of the test program from gems/src/test/dialog to my goa-projects repository [2].
[2] https://codeberg.org/nfeske/goa-projects/commits/branch/main
When you issue 'goa run' for the first time from within the examples/dialog directory, Goa will complain about a missing var/fs directory. To proceed, create this directory manually. Upon the next 'goa run' you should be greeted with the example dialog.
Since there is not much documentation yet, I recommend browsing the Sculpt manager [3], starting with dialog.h that contains quite a few useful building blocks.
In a nutshell, two concepts are important to know. A dialog is a composition of nested "scopes" where each scope is a C++ type (but only a type, no object). The C++ types are leveraged to assure the consistency of the rendering ('view' method) with the event handling ('click'/'clack' methods) at compile time.
E.g., Scope<Vbox> arranges sub scopes vertically. A Scope<Vbox, Frame> is a sub scope of a Vbox that displays a visual boundary. A Scope<Vbox, Frame, Button> displays a button hosted within such a frame. Scopes have no state. You should think of them as a description, not a thing. State is held in widgets. In contrast to a scope (which has no state and therefore does not need to be instantiated), a widget needs to be instantiated because the state has to live somewhere. In the example, the 'Dishes' type is a 'Widget' that keeps the 'selected_item' as state. Usually, widgets are hosted within other widgets. This is modeled by the 'Hosted' template.
Note that even though the UI is quite dynamic (UI elements appear/disappear depending on the state), there is no dynamic memory allocation happening (good for memory safety). The dynamic aspect is realized by a plain condition in the 'view' function.
[3] https://github.com/genodelabs/genode/tree/master/repos/gems/src/app/sculpt_m...
Have fun with experimenting!
Norman