Hi,
 I have a problem, when I try to access the GTK progress bar out of the 
function it was created in.
I have a global variable 
GtkWidget *progressBar;
so that I can access the progress bar from all the functions and different 
files in the project.
When I initilize the bar and call functions to change it's values in the same 
function, everything works fine. I used the following code:
progressBar = gtk_progress_bar_new();  
gtk_box_pack_start (GTK_BOX (vboxGr), progressBar, FALSE, FALSE, 0);
gtk_widget_show (progressBar); 
gtk_progress_bar_set_text (GTK_PROGRESS_BAR(progressBar), "hello");

However, when I call the functions outside of the function where the progress 
bar was created I get an assertion error. The following funcion is defined in 
the same file and I've used similar concepts for various other widgets, it 
doesn't work just for progress bar.
The code is as follows>
void progress()
{
  int i;
  for(i=0;i<1000;i++)
  {
    gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progressBar));
    while (gtk_events_pending ())
    gtk_main_iteration();
  }
}

The error I get is:
Gtk-CRITICAL **: gtk_progress_bar_pulse: assertion `GTK_IS_PROGRESS_BAR (pbar)' 
failed

 I've tried to use the extern declaration, I've tried to combine the code and 
modify various files in various ways just to make the program really convinced 
it's working with a progress bar, I still get the same error. It works only 
when I use it inside the function that it was created in, which is of course 
unimportant, because I need to access it from various callbacks, etc.

This approach works with different widgets perfectly. For instance this 
function works great:

void textField_push(char message[100]){
        extern GtkWidget* textField;
         GtkTextBuffer *buffer; 
        
        buffer = gtk_text_view_get_buffer(textField);
        gtk_text_buffer_set_text(buffer, message, -1);

}

Please help.

thanks,

Michael
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to