[gtkmm] once again : problems with "refreshing the screen"



Hi folks,

In the attached sourcecode i have a progressbar which i use in
"pulse-modus". Everything works fine, but you only see the bar animate
when i focus and unfocus the applicationwindow. Otherwise nothing
happens...

queu_draw() doesn't seem to work..

I've encountered this problem more often, when iam updating a statusbar,
a label, and so on...

Hopefully someone knows the trick.

regards,
-- 
Bart Hakvoort <bart hakvoort castel nl>
#include <gtkmm.h>
#include <unistd.h>
#include <pthread.h>

void * thread( Gtk::ProgressBar * pb )
{
	while ( 1 ) {
		pb->pulse(); usleep(20000);//20 millisecs
		//something here to opdate te screen....
	}
}

class PreMatrix : public Gtk::Window
{

protected:
Gtk::VBox vbox1;
Gtk::Button knp_start;
Gtk::ProgressBar pb;

//signal handlers
void knp_start_clicked()
{
	pthread_t t;
	pthread_create( &t, NULL, thread, &pb );
	
}

public:
PreMatrix()
{
	vbox1.pack_start( pb ); pb.pulse();
	
	knp_start.set_label( "Start!" );
	knp_start.signal_clicked().connect(SigC::slot(*this, &PreMatrix::knp_start_clicked) );
	vbox1.pack_start( knp_start );
		
	add( vbox1 );
	show_all();
}

};


int main( int argc, char * argv[] )
{
	Gtk::Main kit( argc, argv );
	
	PreMatrix prematrix;
	kit.run( prematrix );
}


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