Re: [gtk-list] Returning control to gtk



On Tue, 23 Mar 1999 13:35:13 +0000, gtk-list@redhat.com (Steve Waterworth) wrote:
> I am new to the world of programing in GTK so this might be a stupid
> question but I have yet to find a way to do this...
> 
> Inside a callback routine from a button "clicked". I call a number of
> external (an other API) function calls. I want to use a progress bar or
> statusbar messages to let the user know something is happening (these
> API calls can take a long time). However these widgets will only get
> refreshed when my callback exits. So is there some call to get GTK to
> process and update these widgets without leaving the callback function?

Put the following code snippit strategycally in your callback function:

  while(gtk_events_pending())
    gtk_main_iteration();

Or if you check for events often enough:

  if(gtk_events_pendin())
    gtk_main_iteration();


Erik

PS: it's in the FAQ...

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/




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