I have a situation that I have a two togglebuttons on my ui. I want to have a behavior that if I click one toggle button, the other one gets untoggled.
So far I cannot simply do:
because of the errors with regards to lifetimes, moved values etc.
Does anyone have an idea how to accomplish this?
I would say you should read the Gtk-Rs Book.
I've read it and unless I've missed something I don't see any example there that would be appropriate to my scenario.
I think you will want to use the
glib::clone! macro to copy references to the widgets into your signal handler. There is a blog post explainer here: Lifetimes, Clones, and Closures: Explaining the “glib::clone!()” Macro – Chris's Design & Development
Thanks for the interesting read. In the end I've solved it by binding properties - which actually is explained in the book.