run code when element is displayed #4719
Unanswered
guillaumeAbel
asked this question in
Q&A
Replies: 2 comments
-
update: I attempted to use a callback by invoking app.window().set_rendering_notifier() and monitoring the AfterRendering state in my callback function. However, the measured time is significantly shorter than the actual rendering time. There is a delay of several seconds before I can visualize my element, yet my callback only receives the AfterRendering state after 100 milliseconds. |
Beta Was this translation helpful? Give feedback.
0 replies
-
you may try to make a new callback:
And that created callback you can set an handler in Rust. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone 👋 ,
I'm using slint with rust,
I'm doing some benchmarks so i have to run code when a slint element is displayed.
When i call self::show() on my element, it's not really displayed (only a rectangle of his shape when i click), and i have to call run_event_loop() to see it.
And obviously event_loop is a loop so run code after called it make no sense.
So i would like to call on_init() on my element, which is defined like:
I defined an empty init callback to be sure even if the doc say its by default.
This result to :
I also tried like :
But i cant access to app.table :
So if you know how to do this or if you have another way to run code when my element is displayed, Thanks You 👍 !
Thanks for reading !
Beta Was this translation helpful? Give feedback.
All reactions