[gtkmm] accessing the interface from threads



 I created  a  program  with  two  threads  that  write  to two TextView
widgets, but i can't make the text box follow the cursor. Here's what I
tried:

// for each iteration of the thread function
	Gtk::TextIter buf_end = pExitBuffer->end();
	pExitBuffer->place_cursor(buf_end);

	pExitBuffer->insert_at_cursor( number.str() );

	buf_end = pExitBuffer->end();
	ExitText.scroll_to_iter(buf_end, 0.0);

Sometimes it works, but when two threads are active, I must click on the
text  box for it to get updated! :( I tried a lot of things, but nothing
worked...

Should I lock the thread before accessing the interface widgets? I heard
that gtkmm is not "thread safe"...

-- 
Nicolau Werneck <nwerneck cefala org>         9F99 25AB E47E 8724 2F71
http://cefala.org/~nwerneck                   EA40 DC23 42CE 6B76 B07F
"Facts do not cease to exist because they are ignored."
-- Aldous Huxley




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