Re: [Fwd: program flow--please help]



I use exactly this in my application, when I create a window yes/no, I
connect this window to keyboard signal and the keyboard signal handler
it verify the result, while the system waiting with
gtk_main_iteration(), it's so.

Good Look

Flavio Alberto


 
> <snip>
> 
> > there's something i saw called gtk_main_iteration() or so. it *might*
> > solve your problems. you would call it after making and showing your
> > dialog window and button. i'm not certain exactly how that works. you
> > might have to put it in a loop that waits until you get the event that
> > you're looking for.
> > 
> > maybe:
> > 
> > function_B( GtkWidget *widget, gpointer yes, ...)
> > {
> >   static gboolean first_time = TRUE;
> >   static gboolean got_result = FALSE;
> > 
> >   if( first_time)
> >   {
> >     MAKE DIALOG WINDOW;
> > 
> >     gtk_signal_connect( button_no, ... function_B,
> > INT_TO_GPOINTER(FALSE));
> >     gtk_signal_connect( button_yes, ... function_B,
> > INT_TO_GPOINTER(TRUE));
> > 
> >     while( !got_result )
> >     {
> >        gtk_main_iteration();
> >     }
> > 
> >     reset the static variables...
> > 
> >     got_result = FALSE;
> >     first_time = TRUE;
> > 
> >     destroy the dialog...
> >   }
> > 
> >   else
> >   {
> >      get result: GPOINTER_TO_INT(yes). do something with it!
> >      got_result = TRUE;
> >   }
> > }
> 
> -- 
> 
> -greg
> 
> http://neenjatech.org
> 
> Passionate hatred can give meaning and purpose to an empty life.
>               -- Eric Hoffer
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list




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