Replies: 6 comments
-
This is not yet supported (tracked in #784 ) |
Beta Was this translation helpful? Give feedback.
-
So I am better off going down the file.slint route? Interesting - just made changes to the slint file approach and get exactly same error "use of undeclared type Just looked at issue 784. So do I need multiple .slint files? Or can only one component be exported for the whole application? (ie the last exported component will be exported) |
Beta Was this translation helpful? Give feedback.
-
I am still not sure what the rules are here. The suggestion is that I can have multiple slint! macros but having tried that, C1 component is still undefined And the same is true of using a slint file; that can only have one exported component. The todo example on master branch has the Dialog inside a popupWindow inside an exported component so only a single exported component. But the code on branch release1.4 is very different. Is the code on master the latest, greatest and approved? (code on other branches may be later and greater but if not approved then irrelevant) So can I use multiple slint files and change build.rs to have a list of files? eg |
Beta Was this translation helpful? Give feedback.
-
Just to add. let ui = C1::new()?; Am I trying to the impossible? |
Beta Was this translation helpful? Give feedback.
-
Oops, just came with the same "problem"... |
Beta Was this translation helpful? Give feedback.
-
This quote from the issue is the important bit:
Basically, you have to have everything funnel up to a single component - your main app component. You can only have instances of that one component, and there is no way to reference the other components. You interact by changing state at that top level and the lower level components can access that. I've found this incredibly confusing, and quite different from other UI frameworks I've used. I personally think this is "broken", and forces a lot of coupling between components, but it is possible to work around. Where I have landed is to have a top level components, with "models" for each sub-component. Callbacks go into a global singleton and then I dole those out within the Rust code. Here is the start of my main app window, for example:
Jason |
Beta Was this translation helpful? Give feedback.
-
First many thanks for the several answers to my previous question.
I am continuing with this code, for the moment with the slint! macro approach but will also do the file.slint approach asfter.
So this works
C1 is found, it compiles, happiness ensues. But ...
There is now a compile error saying use of undeclared type C1. Later in the code, I use C2 and that is found. From what I can see multiple components can be exported.
I realise I am not showing the full code but according to VSC my braces are matching. Can there be a Window and Dialog in the same slint macro?
Any other ideas?
regards,
John
Beta Was this translation helpful? Give feedback.
All reactions