On Wed, Mar 31, 2010 at 08:43:14AM -0700, Ken Resander wrote:
> The program has a top window with a menu. The menu is used for functions 
> directly associated with the top window and for functions associated with 
> dialogs that are brought up via the menu. Each dialog has a single textview 
> and the top window menu contains functions that generate and insert text 
> fragments into the textview.
> 
> A dialog gets focus when starting (the title bar has 'active' colour). I then 
> move the caret to the position in the dialog where text is to be inserted and 
> select what to insert from the menu. This causes the focus to move to the top 
> window because the menu is part of it.
> 
> The program writes to the correct place in the dialog by:
> 
> [code]
>    GtkTextBuffer * buf =  gtk_text_view_get_buffer (textviewwidget) ;
>    gtk_widget_grab_focus ( textviewwidget ); // want to force focus back to 
> dialog
>    ... // prepare text, indentation,buf-insert-position etc
>    gtk_text_buffer_insert (buf,...);
> [/code]
> 
> but the focus stays in the top window and I don't understand why. The dialog 
> title bar never changes to active colour, not even a hint or flicker. Having 
> or not having gtk_widget_grab_focus does not seem to make any difference.

It is probably too early to move the focus, the menu will eat it again.
If you connect-after now and it does not help, moving the textview
operation to an idle function should help.

Yeti

_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to