infinite loop problem :(

From: Date: Mon, 09 May 2005 20:13:58 +0000
Subject: infinite loop problem :(
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5836@lists.php.net to get a copy of this message
Hi I have a GtkClist which is filled from Database. Lets say that with every scrolling action rows have to be fetched again and that they are inserted with "remove" and "insert" methods - so I can put them exactly at that row where I want. Example below falls into loop when Scrollbar is used - i would be greatful for showing me some best practices to avoid this loop. Thanks in advance Example below: <?php if( !extension_loaded('gtk')) { dl( 'php_gtk.' . PHP_SHLIB_SUFFIX); } $oWindow =& new GtkWindow(); $oScroll =& new GtkScrolledWindow(); $oAdj =& $oScroll->get_vadjustment(); $oClist =& new GtkClist(3,array('col1','col2','col3')); $oScroll->add( &$oClist ); $oWindow->add( &$oScroll ); $oWindow->show_all(); function kuniec() { gtk::main_quit(); } function fillrows( &$oClist ) { $rows = 100; for( $i=0; $i < $rows; $i++) { for( $i2=0; $i2 < 3; $i2++) $aArray{$i}{$i2} = rand(1,10).rand(100,1000).rand(1000,10000); } for( $i=0; $i<100; $i++) { $oClist->remove($i); $oClist->insert($i, $aArray{$i}); } } $oWindow->connect('destroy','kuniec'); $oWindow->connect('delete-event','kuniec'); $oWindow->connect_object('check-resize', 'fillrows', &$oClist ); $oAdj->connect_object( 'value-changed', 'fillrows', &$oClist ); gtk::main(); ?> -- sorry for my not to good english Łukasz Wojciechowski

« previous php.gtk.general (#5836) next »