[gtkmm] No refresh until mouse moves?

I've been using gtkmm for a week and I love it so far. I've been able to basically create a GUI app in about a week even though I don't have much background in GUI programming. However, as a newbie, I've hit a problem that probably has a simple solution that I've overlooked (though I have search the docs and google). Here is the problem :

After I insert some text into a TextBuffer, I would like the text to immediately appear in the TextView associated with the TextBuffer. However, it seems that I don't see the text until I mouse over the window or, if the window is already focused, until I move the mouse over a button or click inside the TextView.
  My question is: how do I force the TextView to refresh?

Here's some of the code :

MyApp::MyApp() {

  Gtk::TextView dialog; // the TextView that shows the text.
  dialog(Gtk::TextBuffer::create()); // associate a TextBuffer with the TextView.

  // now, start a thread to send text to the TextView's TextBuffer.
  pthread_t hello_thr;
  pthread_create(&hello_thr, NULL, EndlessLoopWrapper,(void*)this);


void EndlessLoopWrapper(void* myapp) {

void MyApp::EndlessLoop() {
   while(1) {

void MyApp::refresh_text_view(const Gtk::TextBuffer::iterator& pos, const Glib::ustring& text, int bytes) {
 std::cerr << "going to refresh now!" << std::endl;
 // try (unsuccessfully) to do various things to make the TextView refresh...

..but none of the things I do in MyApp::refresh_text_view() above seems to get the TextView to refresh :(

..Thanks for any tips...

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