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

allow child properties on components #46

Open
nt8r opened this issue May 28, 2020 · 0 comments
Open

allow child properties on components #46

nt8r opened this issue May 28, 2020 · 0 comments

Comments

@nt8r
Copy link
Contributor

nt8r commented May 28, 2020

See PR #44: the following gtk markup works:

<Notebook show_tabs=true show_border=false>
    <Entry Notebook::tab_label="filename" />
</Notebook>

but this markup fails:

<Notebook show_tabs=true show_border=false>
    <@CustomComponent Notebook::tab_label="filename" />
</Notebook>

with the error:

error[E0277]: the trait bound `glib::object::Object: glib::object::IsA<gtk::auto::widget::Widget>` is not satisfied
   --> src/main.rs:100:22
    |
100 |                                             Notebook::tab_label="foo"
    |                                                       ^^^^^^^^^ the trait `glib::object::IsA<gtk::auto::widget::Widget>` is not implemented for `glib::object::Object`
    |
    = help: the following implementations were found:
              <glib::object::Object as glib::object::IsA<glib::object::Object>>
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

It seems that one can only set child properties on widgets, not components. It seems like it would be possible to set the child property on the component's top-level widget in its view function, but this is presently silently ignored, and would breaks modularity even if it worked: component implementations would need to know what their containers would be.

Can vgtk allow child properties on component instantiations (and perhaps explicitly disallow child properties from top-level widgets returned by view functions, since they have no effect there)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant