Well, firstly I'm very glad for all the indications that I receive from 
everybody.If it was possible I will pay a beer to everybody.....or more than 
one  in more than one case :)


>$win->btnHide()->SetFocus();  #fails on run-time,  btnHide?


I'm going to include the event that is sorrounding my head ...this is an event 
that comes from a TreeView, I comment some thinks in bold ,that is: 

sub Tree_NodeClick
{
 $posdinsalu=0;
 for my $est_alu (@alumne)
 {
   if ($est_alu->{Arbre}==$_[0])
   {
  if (!exists ($w_analisi[$posdinsalu]))
  {
   # I Create dinamically a window that depens on a variable
   $w_analisi[$posdinsalu] = Win32::GUI::Window->new (
     -top  => 0,
     -left  => 0,
     -width     => 600, 
     -height    => 400,
        -minsize => [600,400],
     -text  => "Comentaris respecte $est_alu->{Nom}", 
     -name  => "Mailtool::tutor::e_w_analisi_$posdinsalu",);

   $canviat[$posdinsalu]=0;
   
   open ENTSIS,"<sessions/${posdinsalu}${noms}.txt";
   
   $res =<ENTSIS>;
   chop ($res);
   $toteltex=$res;
   while($res =<ENTSIS>)
   {
    chop ($res);
    $toteltex=$toteltex."\r\n".$res;
   }
   close ENTSIS;

    $comentaris[$posdinsalu] =$w_analisi[$posdinsalu]->AddTextfield(
     -foreground => [0, 0, 0],  # Color del text: negre
     -font  => $Mailtool::mevesfonts::fo_normal,
     -left  => 10,
     -top  => 10,
     -height  => 350,
     -width  => 480,
     -name  => "Mailtool::tutor::t_comentari_$posdinsalu",
     -addstyle => WS_CHILD | WS_VISIBLE | WS_VSCROLL 
                | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL,);

   $comentaris[$posdinsalu]->Text("${toteltex}");

   $b_guardar[$posdinsalu] = $w_analisi[$posdinsalu]->AddButton(
     -text  => "GUARDAR", # Text al botó
     -font  => $Mailtool::mevesfonts::fo_normal,
     -left  => 510,
     -top  => 85,
     -height  => 25,
     -name  => "Mailtool::tutor::b_$posdinsalu",);

   ## Ens cal fer us de eval per al tractament dels events de les finestres 
dinàmiques.
  ## Aldo told me about the use of eval....it works good
       eval qq{    
           sub Mailtool::tutor::b_${posdinsalu}_Click {
               Mailtool::tutor::b_Click($posdinsalu);}
         
           sub Mailtool::tutor::e_w_analisi_${posdinsalu}_Terminate {
               Mailtool::tutor::e_w_analisi_Terminate($posdinsalu);}
      
           sub Mailtool::tutor::t_comentari_${posdinsalu}_Change {
               Mailtool::tutor::t_comentari_Change($posdinsalu);}
              };
   # Here stars the problem, the new windows appears for miliseconds but goes 
beneath the $w_tutor
   $w_analisi[$posdinsalu]->Show();
   $w_analisi[$posdinsalu]->SetForegroundWindow();
   $w_analisi[$posdinsalu]->SetFocus();

  }
  else
     {
    # In case that I reopen a dinamic window the first time it doesn't open, 
but yes the next time, after another one, for example
     $w_analisi[$posdinsalu]->Show();

     } 
   }   
 }

    return 0;
}

A lot of thaks to everybody !!!

Regards from Catalonia,
Guillem Cunillera i Wefers "Cuni"

Reply via email to