Closed nt8r closed 4 years ago
I got it working with the current codebase by wrapping the inner element in a Box
, if that helps.
<Notebook show_tabs=true show_border=false>
<Box Notebook::tab_label="filename">
<@CustomComponent />
</Box>
</Notebook>
@LiHRaM thanks for the investigation. I think I understand the problem now: the attribute needs to be placed on widget the inside the component's view function, not on the component itself. I wonder if vgtk could be modified so that the latter worked too? The status quo makes it hard to reuse components in multiple contexts, since contextual properties have to be set inside the component definition. This PR should probably be closed, but I'll file an issue on this question.
It turns out, child properties are silently ignored on the top-level widget of the component's view function, so @LiHRaM 's workaround works but the workaround of moving the child property inside the component does not. I'll mention this in the issue.
This is not the most flexible interface, but handles the simple case of notebooks with textual tab labels.
I'd appreciate review about
object::Cast
; I couldn't get a simple usage settingNotebook::tab_label_text
to a string literal to typecheck with a<P: IsA<...>>
bound ofObject
orWidget
for the child parameter. Am I missing things or is the flexibility of dynamic casting necessary here?