On Wed, 2006-10-04 at 23:34 -0400, Melvin Newman wrote: > My saga towards updating the GUI continues... the following are two > code snippets: While Paul explained why the code does not compile, I did a quick google search and found this e-mail exchange which talks about how to do the same things as g_idle_add but with within the framework of GtkMM. This will likely help you figure out how to set a non-static class member as a callback: http://www.nabble.com/Threading-Problem-t2341133.html Specifically, perhaps this will work: http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1SignalIdle.html Signal handlers in Gtkmm are allowed to be non-static class members so maybe this would work for you. Michael > > 1) My window update function. It is built into the window1 class and > is supposed to update the main GUI window: > > gboolean window1::updater(gpointer data) > { > /* Variables > ******************************************/ > Glib::RefPtr<Gdk::Window>win = get_window(); > /*****************************************/ > > if(win) > { > Gdk::Rectangle r(0, 0, get_allocation().get_width > (),get_allocation().get_height()); > win->invalidate_rect(r, false); > } > return(true); > } > > > 2) The following is my thread that calls this function through the > g_idle_add() function... Unfortunately it does not compile at this > line and being new to OO/C++ I have no idea why, or how to fix the > problem: > > void *server_connect(void *ptr) > { > /* Variables > ******************************************/ > int tmp=0; > int socket_id; > struct sockaddr_in address; > gpointer data; > Glib::RefPtr<Gtk::TextBuffer> buffer; > sigc::connection pipe1; > /*****************************************/ > > socket_id = pthread_arg.socket_id; > address = pthread_arg.address; > buffer = pthread_arg.out_put_buffer; > > do > { > tmp = connect (socket_id,(struct sockaddr *) &address, sizeof > (struct sockaddr)); > if (tmp <0) > { > buffer->insert_at_cursor("@"); > > g_idle_add(window1::updater,false); > ^-- Compiling stops here with: error: invalid use of > non-static member function `gboolean window1::updater(void*)' > > Glib::usleep(400000); > } > > }while(tmp<0); > > } > > Unfortunately I cant seem to integrate the server_connect function > into the class, because pthread then complains that it can not call it > (miss mach type). > > Any help would be greatly appreciated. > > Sincerely > Melvin Newman > _______________________________________________ > gtk-list mailing list > gtk-list@xxxxxxxxx > http://mail.gnome.org/mailman/listinfo/gtk-list _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list