How to move focus to another window by program?

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

 



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.

The dialog gets focus if I click the title bar and the textview then shows the caret in correct position immediately after the inserted text. I don't think users would be happy having to do this clicking. The program should do it and force the caret back to the dialog.

How can this be achieved?
 


New Email addresses available on Yahoo!
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does!
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux