[gtkmm] No refresh until mouse moves?
- From: Eugene Koontz <ekoontz slt sel sony com>
- Cc: gtkmm-list gnome org
- Subject: [gtkmm] No refresh until mouse moves?
- Date: Fri, 25 Apr 2003 12:41:31 -0700
Hi,
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.
dialog.get_buffer()->signal_insert().connect(slot(*this,&MyApp::refresh_text_view));
// now, start a thread to send text to the TextView's TextBuffer.
pthread_t hello_thr;
pthread_create(&hello_thr, NULL, EndlessLoopWrapper,(void*)this);
show_all();
}
void EndlessLoopWrapper(void* myapp) {
(MyApp*)->EndlessLoop();
}
void MyApp::EndlessLoop() {
while(1) {
sleep(1);
(dialog.get_buffer())->insert_with_tag(dialog.get_buffer()->end(),"hello\n",UserStyle);
}
}
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...
dialog.activate();
dialog.grab_focus();
dialog.show();
dialog.queue_draw();
raise();
}
..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]