Re: Updating a statusbar widget




On Sun, 23 Jul 2000, Vlad Harchev wrote:

> 
> while (gtk_events_pending())
>         gtk_main_iteration();
> 


I am doing this, see my print_status function to write text
status to a label:

int print_status( char *fmt, ... )
{
   char buf[256];
   va_list argptr;

   va_start( argptr, fmt);
   vsprintf( buf, fmt, argptr);
   va_end( argptr );

   /* update single line feedback widget on main screen */
   gtk_label_set_text( GTK_LABEL(Feedback_search_w), buf );

   /* force update of widgets */
   while ( gtk_events_pending() ) 
      gtk_main_iteration();
   // while ( gtk_main_iteration());   <- this one from the FAQ don't  work!

   return ERR_NONE;
}

Some problems:

1. The suggested code from the FAQ doesn't work:
     "while (gtk_main_iteration(FALSE));"
   I am using GTK 1.2.7. Is the FAQ out of date with the GTK release?

2. Worse, this solution does more than just drawing updates. It also
   processing other events on the queue. If I call print_status(), any
   user input to widget and their call backs are called, expired timers
   call backs get called, etc This make the cure, worse that the problem.

Is there a better method to handle this situation?
I think this is the best gtk 1.2.x can do. Will 1.4.x work better?

Tony
 
/-----------------------------------------------------------------------------\
| Tony Denault                        | Internet: denault@irtf.ifa.hawaii.edu |
| NASA IRTF, Institute of Astronomy   |                 Phone: (808) 974-4206 |
| 1175 Manono St., Bldg 393           |                   Fax: (808) 974-4207 |
| Hilo, Hawaii 96720                  |                                       |
\-----------------------------------------------------------------------------/








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