You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a Slint UI application where my main window contains a button that opens a new child window with a form. I want to automatically close this child window after the form is successfully submitted (when no validation errors are found).
Currently, window closing is only handled through the on_close_request event, which is triggered by window management actions (like clicking the X button). However, I need a way to programmatically close the window from within my code after form submission.
Current Behavior
Main window opens child window via button click
Form submission is processed
Window remains open even after successful submission
Window can only be closed through window manager actions
Desired Behavior
Main window opens child window via button click
Form submission is processed
If submission is successful (no errors), window automatically closes
If submission has errors, window remains open
Question
Is there an API method available to programmatically close a Slint window? Looking for something similar to:
// Pseudo-code of what I'm looking forif form_submission.is_successful(){
child_window.close();}
or
The on_close_request event handler is not sufficient for this use case as it only handles window manager close events
Need a programmatic way to trigger window closure from within the application logic
similar issue: #5465 marked answered but it's not.
The text was updated successfully, but these errors were encountered:
I think hide() is the way to do this. As its and show()s docs say, a strong reference to the component is internally maintained by Slint, while the window is visible. I.e., you can visually hide the window, which is already the closing from the end user's perspective (and discards the internal strong reference), and then it's up to you whether you want to cause the window component instance to be destroyed by dropping it (the only strong instance left; many things are like Rc in Slint).
Description
I'm working on a Slint UI application where my main window contains a button that opens a new child window with a form. I want to automatically close this child window after the form is successfully submitted (when no validation errors are found).
Currently, window closing is only handled through the
on_close_request
event, which is triggered by window management actions (like clicking the X button). However, I need a way to programmatically close the window from within my code after form submission.Current Behavior
Desired Behavior
Question
Is there an API method available to programmatically close a Slint window? Looking for something similar to:
or
on_close_request
event handler is not sufficient for this use case as it only handles window manager close eventssimilar issue: #5465 marked answered but it's not.
The text was updated successfully, but these errors were encountered: