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

2007-06-05 Thread Toralf Lund

 [ ... ] And I don't see 
 the GtkEntry in question from inside signal handers for buttons, menu 
 items etc, of course...
 

 You do.  When the action that requires to commit the update
 first occurs, use gtk_window_set_focus() (you should be able
 to see the window) to get the focused widget, check
 whether it needs activate to be emitted on it (this can be
 done for instance by marking it with g_object_set_data() and
 then looking for the data) and call gtk_widget_activate() it
 if does.
   
Ah. I never really noticed the get_focus call... It suspect that getting 
this right will (still) be somewhat complicated, but I suppose it may be 
done. I'd still prefer to have a different kind of leave or focus 
out signal, though, but I suppose it just isn't there ;-(

Thanks, anyway.

- Toralf

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


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

2007-06-01 Thread Toralf Lund
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
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


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

2007-06-01 Thread Yeti
On Fri, Jun 01, 2007 at 01:42:14PM +0200, Toralf Lund wrote:
 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...

You do.  When the action that requires to commit the update
first occurs, use gtk_window_set_focus() (you should be able
to see the window) to get the focused widget, check
whether it needs activate to be emitted on it (this can be
done for instance by marking it with g_object_set_data() and
then looking for the data) and call gtk_widget_activate() it
if does.

Yeti

--
http://gwyddion.net/
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list