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

Gtk::UiTemplate always requires children #33

Closed
BlobCodes opened this issue Sep 9, 2022 · 0 comments
Closed

Gtk::UiTemplate always requires children #33

BlobCodes opened this issue Sep 9, 2022 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@BlobCodes
Copy link
Contributor

When trying to assign a ui template to a class without any children, you can't just leave out the children field in the annotation.

@[Gtk::UiTemplate(file: "(some path)", children: [] of Symbol)]
class Test < Gtk::Box
end

This works.

@[Gtk::UiTemplate(file: "(some path)")]
class Test < Gtk::Box
end

This raises the following exception:

In lib/gtk4/lib/gtk4/src/bindings/gtk/widget_template.cr:45:58

 45 | {% for child in @type.annotation(Gtk::UiTemplate)[:children] %}
                                                       ^
Error: `for` expression must be an array, hash, tuple, named tuple or a range literal, not NilLiteral:

nil
@hugopl hugopl added bug Something isn't working good first issue Good for newcomers labels Sep 9, 2022
@hugopl hugopl closed this as completed in 1dcd8a4 Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants