Help Newbie cause updates of Notebook with textview

Hi All,

For my first use of GTK ( I have GTK 2.0 on RedHat 9) I'm building a GUI that uses a notebook widget, where each page of the notebook has a textview.   I build up my window, do gtk_widget_show() and run gtk_main() and everything looks fine.  I'm trying to cause an update of the text in the notebook pages when my external application calls for it.  So I have

void UpdateDisplay(  char * pTextToWrite )
        GtkWidget *buffer;

         buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( GlobalPointerToTextView1 ));
         gtk_text_buffer_set_text( buffer, pTextToWrite, -1 );

          // try to show the updated text 
          gtk_widget_show_now( GlobalPointerToTextView1 );
My problem is that I call this routine from my external code, and the update doesn't show up on the GUI until I mouse click on one of the xterms on the screen.  From browsing the archive, I naively tried adding

while( g_main_pending() ) { g_main_context_iteration( NULL, FALSE ); }

but got the complaint (DUH) "GLIB-WARNING: g_main_context_prepare(): main loop already active in another thread"
which makes sense, since this call of UpdateDisplay() is on the thread of my external application.  

Is there a call I can make in UpdateDisplay() that will force update/redisplay of the GUI?



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