main() function cannot be @Composable - Window title as a mutable state #612
Unanswered
damien79github
asked this question in
Q&A
Replies: 2 comments 3 replies
-
You don't need the |
Beta Was this translation helpful? Give feedback.
1 reply
-
Thanks for your answer. I have adapted my code accordingly : private var title by mutableStateOf("Title") There is no runtime error but the title of the Window does not refresh when the button is clicked. What's missing for the UI to be updated with the mutable state title var ? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm trying to get started with Compose for Desktop. I love Kotlin and it's fantastic to have Compose for Desktop.
I would like to have the title of a Window a mutable state. But trying to do so :
var text by remember { mutableStateOf("Title") }
@composable
fun main() = Window(title = text) {
I run into 2 errors :
@composable invocations can only happen from the context of a @composable function
@composable main functions are not currently supported
Window() is a top function call. How can I make the title of a Window a mutable state ?
That would be the necessary for instance to make an editor app the the Window title is the path of the file opened in the editor.
Thanks a lot for your help.
Beta Was this translation helpful? Give feedback.
All reactions