Comments (3)
They could return a Future
such as slint::JoinHandle
.
This would unfortunately be a breaking change, I think. So If we want to have support of this before Slint 2.0, it would need to be another function name.
from slint.
Note that the code that you wrote with an atomic will not work, because the callback will be run in another thread and can be run after you check the cancelled
As of now, you can use tokio channel.
For example (untested, please let me know if you find mistakes)
let (tx, rx) = tokio::sync::mpsc::channel(1);
dialog_weak.upgrade_in_event_loop(move |dialog| {
let c = dalog.get_cancelled();
tx.send(c).unwrap();
}).unwrap();
let cancelled = rx.recv().await.unwrap();
You can use std's channel if you don't want to use async channel.
from slint.
Yes, I learned (the hard way) that what I proposed wouldn't work - and yes there are plenty of ways to snake a return value out of such a callback, but none of them would be as convenient as a hypothetical invoke_from_event_loop_with_retval()
function or the equivalent.
I'll defer to you guys what should happen to this specific GitHub issue
from slint.
Related Issues (20)
- use backend-linuxkms and renderer-software error HOT 6
- Double clicked of TouchArea in Flickable does not trigger
- Custom input validation for LineEdit/TextEdit HOT 3
- Integration with Rust 3D Graphics Libraries
- Generated C++ code issue with keyword "delete" HOT 3
- slint preview window not close-able on wayland HOT 2
- Feature Request: create an exclusive repository to the documentation HOT 3
- main thread panicked when pressing / moving a button added to a component HOT 4
- ComboBox: Popup height is not adjusting to items count HOT 2
- ComboBox: Popup position and width does not adjust to window resizes HOT 9
- VSCode language server panic in resolving.rs HOT 1
- VS Code extension: Disable Wayland use when running under WSL
- macOS: Showing a previously minimized/hidden window fails to resume animations and freezes
- live preview: Things arer added with x and y property in layouts HOT 1
- Warning in Slint autogen code: variant `Destructive` is never constructed
- Add a callback to `ListView` / `ScrollView`
- Wayland: Add support for reconnecting to the compositor
- LSP Offset Encoding HOT 1
- The official game demo, named `MemoryTile`, the CPU usage is very high (around 30 percent).
- UI sometimes looks invalid when adjusting size HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slint.