Re: simple question
| From: | Thetten David | Date: | Wed, 27 Jun 2001 07:37:47 +0000 |
| Subject: | Re: simple question | ||
| Groups: | php.gtk | ||
| Request: | Send a blank email to php-gtk+get-1980@lists.php.net to get a copy of this message | ||
I think i wasn't clear enough
this is an extract of my real class :
(this is just an extract so it may not be correct but my algorithm is here)
class fenetre_principale
{
var $nblig;
var $clist;
var $fs;//my gtkfileselection
function fenetre_principale()
{
$this->nblig=0;
//adding my widgets...
}
function conversion()
{
$clist=&$this->clist;
printf("nblig = %d\n",$this->nblig);
}
function finselectfichier()
{
$fs=&$this->fs;
$clist=&$this->clist;
$fichier[0]=$fs->get_filename();
$fichier[0]=strtolower($fichier[0]);
if(!($mydir=opendir($fichier[0])))
{
echo "erreur lors de l'ouverture du repertoire";
return false;
}
else
{
while($nom_fic=readdir($mydir))
{
$fichier[0]=$fs->get_filename(); $fichier[0].=$nom_fic;
$fichier[0]=strtolower($fichier[0]);
if( !is_dir($fichier[0]))
{
$clist->append($fichier);
$this->nblig++; printf("nblig = %d\n",$this->nblig);
}
}
}
$fs->destroy();
}
function remove()
{
$clist=&$this->clist;
$clist->freeze();
if (($row = $clist->selection[0]) !== null)
{
$clist->remove($row);
$this->nblig--;
printf("nblig = %d\n",$this->nblig);
}
$clist->thaw();
}
}
my problem is :
function finselectfichier() is called when pressing the ok button of a gtkfileselection dialog, it adds in the clist as many lines as files in the directory selected
function remove() removes the line selected in the clist
function conversion() is supposed to use the files in the clist to process them ( this function is called with a button )
but between each function call it seems that php-gtk has forgotten the value of $nblig
let's say i've chosen a directory containing 3 files //first step
then i choose to remove one //second step
then i press the conversion button //third step
my screen is:
nblig=1;
nblig=2;
nblig=3;//end of first step
nblig=-1;//end of second step
nblig=0;//end of third step
my thinking is that php has unset my $nblig variable between two function calls.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.