Button callbacks #5
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: rafaelcaricio/lvgl-rs#5
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
How can I define a button "on-click" callback?
I'm trying to add a button example and I'm stuck trying to type the callback to
lvgl_sys::lvgl_obj_set_event_cb
It seems like
lvgl_sys
wants the callback to be anunsafe extern "C"
function, which doesn't really make sense if I'm providing this callback from Rust ...Hi @justinmoon,
It is flattering that you have interest in using lvgl-rs. I just wanted to tell you that this project is in the very early stages of development. I would really appreciate help of others, like you, to push this project forward. Most things are still missing and I'm still pondering about how to handle the global state dependency in lvgl library rely.
No problem. I'll try to help out wherever I can.
In general, I'm trying to follow the recommendations from those articles:
Thanks for sharing.
I'm trying to figure out how to get these event callbacks working. This post seems to explain roughly what is needed, but still working on it
On a related note, how were you able to get a button to look like this?
Mine look like this
Might help if you could add whatever code produced your screenshot as an example.
@justinmoon that screenshot was in an earlier version of the demo app,
7bf1ac0cae/examples/demo/src/main.rs
I was using SDL directly.Hey @justinmoon , I just implemented a way to add event callbacks. So you can do things when buttons are clicked, hovered, etc. Please look the example:
https://github.com/rafaelcaricio/lvgl-rs/blob/master/examples/bar.rs#L48-L52
I will close this ticket now, as this is now supported. If you have other questions. Please open other issue.