i replied directly to him with my idea. not sure if it's correct, but since you're discussing it, i thought i'd put it up :)
shouldn't application development issues be on [EMAIL PROTECTED]? greg wrote: > > A R Hummaida wrote: > > i have a call back function A that within it calls another function B. > > the later displays a window for the user to confirm something. > > during this time fuction A does not wait for B to return, but carries > > till it finshes. thats not what i am used to in c. > > how could i get A to wait untill B returns ?(ie after a user confirms > > within B). i have generated most of the code using Glade. > > yeah, sounds like you're not used to gtk yet :) so, B makes a window > with button and shows it, right? there's nothing there to stop it. in > order for the window to be shown, your program needs to return to the > gtk_main() loop. gtk doesn't do anything to change the way that C works. > rather, the functions that you call don't block until the user clicks > your button. > > i think there is a way to do what you want, and i'm pretty certain it's > been discussed before. > > take a look in the archives here (i have to find something there > myself.): > http://mail.gnome.org/archives/gtk-app-devel-list/ > > do a search for block, event, and dialog. greg wrote: > > A R Hummaida wrote: > > > yes i have been looking at the code more, and some how i need function B > > not to end or reach end before the user has > > clicked a button. > > thanks. > <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 [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
