Closed mezeipetister closed 4 years ago
You need to store the return value of connect_insert_text()
somehow and pass it into the closure. One way of doing that is to store it in a Rc<RefCell<Option<SignalHandlerId>>>
. You would initialize that with None
, pass a clone into the closure and after connecting fill in the value. Not very beautiful but the signal handler does not know its signal handler id by itself.
Hi Guys, Could you help me, how to block and unblock signal inside a connect_insert_text()? I would like to write a custom entry validator, that can access and even modify the entry inserted text. But when I use entry.insert_text(..) I got an event loop, and with overflow it exit. I did read in a gtk-py tutorial, that I need to block the signal before the insert_text(..), and unblock it after. But for block_signal(..) I need the SignalHandlerId, which is not available inside that closure.
Here is the code:
So in the block_signal part, how can I know the signalHandlerId?
Thank you in advance!
Best wishes, Peter Mezei.
U.I.: GTK-RS is AWESOME!