Two problems: GtkEntry focus without cursor - fork usage



Hi

Using GTK 1.2.5 I have two problems:


In a window I've got a combo box that is disabled (gtk_widget_set_sensitive(...,0))
usually. A handler of an optionmenu item sets the text in the combo entry box 
(gtk_entry_set_text), then selects all the text (gtk_entry_select_region) so that 
the user can type away replacing the text if she wishes. I noticed to have the 
focus in the entry, a gtk_widget_grab_focus call is required. Finally, the combo
is enabled (gtk_widget_set_sensitive(...,1)).

So now the user can type away, and the characters do arrive in the entry box,
but there is no cursor ! This is not much of a problem as long as the text
is typed straight in, however it becomes a major nuisance if the cursor
left/right keys are to be used to edit the text.

The cursor appears if the user clicks into the entry field. At the same
time, the entry gets the familiar one-pixel wide frame that denotes the
active widget. Any clues ?


The second problem is on using the fork() call to spawn another process.
Defining a subroutine
int test(void)
{
   if ((exec_child = fork()) != 0)
     {
        return ((exec_child == -1) ? TRUE : FALSE);
      }

   exit (0);
 }
one would expect that by calling it spawns a child that doesn't do much but
terminate immediately without affecting the main process. This is what it 
does if it is called from main() before gtk_init. If it is called from main() 
after that point, it appears to work alright, however the app terminates at
the moment gtk_main is called, without any window appearing. If it is called
from a button-clicked handler (which was my original intention), the entire
application terminates at the moment the child calls exit(0). This is evident
from inserting a sleep(10) before the exit call.

I'm using a program skeleton written by glade, the main() looks

   gtk_set_locale ();
   gtk_init (&argc, &argv);

   add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps");
   add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");

   gtk_widget_show (mainwin = create_mainwin());

   gtk_main ();

Any ideas ?


Cheers  Peter
-- 
---------------------------------------------------------------------
      Dr. Peter Rottengatter       peter rottengatter de
                                   http://www.rottengatter.de
---------------------------------------------------------------------






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