Today is one day that sometimes I feel I'm turning crazy ....

I make a Listview in a simple program but when I put in my main program in a pm 
module ListView doesn't work (is don't show) and the complete name is done. 
This problem has not appear with other widgets...and before put a ListView 
there was a ListBox that worked well.

Any ideas ???

Guillem Cunillera

##Interfície gràfica pel Parsev70b
##AUTOR: Guillem Cunillera i Wefers

use Mailtool::gethttp;
use Mailtool::tutor;
use Mailtool::config;
use Mailtool::consultor;
use Mailtool::loginUOC;
use Mailtool::mevesfonts;

use Win32::GUI;
use Win32::Clipboard;
use Win32::API;

package Mailtool::seleccio;

  my $CLIP=Win32::Clipboard();
   my $out;


# =====================
# FINESTRES
# =====================
  
$w_principal = Win32::GUI::Window->new (
 -maxsize => [600,440], 
 -width  => 600, 
 -height  => 440, 
 -text  => "Seguiment 0.7 - Versió de prova    ", 
 -name  => "Mailtool::seleccio::e_w_principal",)
;
 
$w_principal->AddLabel(
 -font  => $Mailtool::mevesfonts::fo_cursiva,
 -foreground => [0, 0, 0],  # Color del text: negre
 -width  => 200,
 -height  => 20,
 -left  => 5,
 -top  => 55,
 -text  => "Perfils existents",);
 
$w_principal->AddButton(
 -text  => "NOU PERFIL",
 -font  => $Mailtool::mevesfonts::fo_normal,
 -left  => 350,
 -top  => 275,
 -height  => 25,
 -width  => 110,
 -name  => "Mailtool::seleccio::b_nou_perfil",);
$w_principal->AddButton(
 -text  => "BORRAR PERFIL",
 -font  => $Mailtool::mevesfonts::fo_normal,
 -left  => 350,
 -top  => 205,
 -height  => 25,
 -width  => 110,
 -name  => "Mailtool::seleccio::b_borrar_perfil",);
$w_principal->AddButton(
 -text  => "AJUDA",
 -font  => $Mailtool::mevesfonts::fo_normal,
 -left  => 470,
 -top  => 275,
 -height  => 25,
 -width  => 70,
 -name  => "Mailtool::seleccio::b_ajuda_perfil",);
$bexecucio = $w_principal->AddButton(
 -text  => "INFORMACIÓ DISPONIBLE", # Text al botó
 -font  => $Mailtool::mevesfonts::fo_normal,
 -left  => 80,
 -top  => 270,
 -height  => 30,
 -name  => "Mailtool::seleccio::b_execucio",);
$bsortir = $w_principal->AddButton(
 -text  => "SORTIR", # Text al botó
 -font  => $Mailtool::mevesfonts::fo_normal,
 -left  => 500,
 -top  => 380,
 -height  => 30,
 -name  => "Mailtool::seleccio::b_sortir",); 

my $listview = $w_principal->AddListView(
    -name      => "Mailtool::seleccio::listview",
    -text      => "Collons",
    -left      => 5, 
    -top       => 75,
    -width     => 340,
    -height    => 195,
    -style     => WS_VISIBLE | 2,
    -fullrowselect => 1,
    -gridlines => 0,
    -checkboxes => 0,
    -hottrack   => 1,
 
);

$listview->InsertColumn(
    -index => 0, 
    -width => 150, 
    -text  => "Nom",
);

$listview->InsertColumn(
    -index   => 1, 
    -subitem => 1, 
    -width   => 150, 
    -text    => "Tipus perfil",
); 

my $dirses = "sessions";


# =====================
# CRIDES INTERNES
# =====================

sub InsertListItem {
    my($perfi, $nom, $qua) = @_;
    my $item = $listview->InsertItem(
        -item  => $listview->Count(), 
        -text  => $perfi, 
        -image => $image,
    );
 
    $listview->SetItem(
        -item    => $item, 
        -subitem => 1,
        -text    => $nom,
    );
 $listview->SetItem(
        -item    => $item, 
        -subitem => 2,
        -text    => $qua,
    ); 
}



# =====================
# CRIDES EXTERNES
# =====================

# -------------------------------------
sub inicia {
# -------------------------------------
 
 $Mailtool::loginUOC::NSES="0";

 -d $dirses or mkdir $dirses;
 open ENTSIS,"<sessions/default.txt";
 
 while($res =<ENTSIS>)
 {
  chop ($res);
  my @partim =split ',',$res;
  print "-------->>> $partim[0],$partim[1],$partim[2] \n";
  InsertListItem($partim[0],$partim[1],$partim[2]);
 }
 close ENTSIS;
 
  $w_principal->Show();
 $w_principal->Show();

   $listview->View(1);
   $listview->Update();
 $listview->View(1);
 $listview->Update();

  Win32::GUI::Dialog();  # Inici d'execucio gràfica
}


...


Reply via email to