GtkEntry update problems. Or: How do I force a widget to loose focus?



In one of our applications, we have lots of GtkEntry widgets that "mirror" values also stored in variables. For reasons I won't go into here, we don't want to change the variables in question each and every time a character is typed, so we are doing updates on the "activate" and "focus-out", which means that values are synchronised if the user moves the cursor e.g. to another GtkEntry field, and an update may also be forced by pressing Enter. That's very nearly what we want, but not quite. The problem is that the "focus-out" event only occurs if the user selects another that will accept focus. This is not the case for e.g. menu items or toolbar items, so no variables are updated when those are selected - and we want them to be.

So, is there any way at all I can make sure my variable is updated in all cases where the user stops entering text and selects anther GUI item? Essentially, the problem would be solved if I could force the focus to be taken away from the GtkEntry widget, but how? I might use the "grab_focus" call, of course, but I would have to add this to signals on all other widgets, then, and even that may not help, since I don't necessarily have a widget that can accept focus. And I don't "see" the GtkEntry in question from inside signal handers for buttons, menu items etc, of course...

Ideas, anyone?

- Toralf



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]