[gtkmm] Problems with label and TextView



Hi everyone,

I am writing cause i am having some problems to write both in label and textview widgets. I wrote a program with gtkmm 2 for win32 that has a thread to read from a socket and everytime this thread read a message I increment an integer counter that must be displayed to the user but when I tried do display it in a label the whole application interface stop I mean the application continue to work but the user can not work with the interface anymore, so i tried to put display this counter in a textview widget but i´ve got some problems too, with the textview the application doesn´t stops but the textview is updated only when the cursor is set to it...I would like to know if anyone have an idea of what is happenning and if anyone could help me, if anyone know if is there something i can do to update the textview without the cursor set to it or/and if i can update the label without make the application stop....The code for the label/textview update is written below:


/*Thread for update the label/textview - counter is a global variable*/

     int old_counter=0;
     Gtk::TextView* ptxtcounter = 0;
     Gtk::Label* plblcounter=0;
     Glib::RefPtr<Gtk::TextBuffer> textview_buffer;


      meu_refXml->get_widget("txtcounter",ptxtcounter);
      meu_refXml->get_widget("lblcounter",plblcounter);

while(1)
{
    if (old_counter < counter)
 {
     textview_buffer = ptxtcounter->get_buffer();
     sprintf(auxiliary,"%d",counter);
     str_counter.assign(auxiliary);
     textview_buffer->set_text(str_counter);
     plblContador->set_text(str_conter);
     old_counter = counter;
  }
}


/*End*/


I would be very glade if anyone could help me....

Thanks for now,

                   Carlos Augusto

_________________________________________________________________
MSN Hotmail, o maior webmail do Brasil.  http://www.hotmail.com




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