Here is a code to prove that your piece of code works okay, and an error is somewhere else.
Note that this is a quick and dirty mix of examples from Win32::GUI and your code, so please say nothing about quality of code.
Version of Win32::GUI is 0.0.558 (just upgraded :)
use Win32::GUI;
print "hwnd = $Win32::GUI::hwnd\n";
print "hinstance = $Win32::GUI::hinstance\n";
# GUI::Show($Win32::GUI::hwnd, 6);
#$Icon = new GUI::Icon("perl.ico");
#print "Icon: $Icon->{handle}\n";
my $win = new GUI::Window(
-name => "Window",
-style => WS_OVERLAPPEDWINDOW,
-text => "Win32::GUI TEST - ListView",
-height => 200, -width => 300,
-left => 100, -top => 100,
);
$LV = $win->AddListView(
-name => "lvwData_Entered",
-text => "hello world!",
-left => 10,
-top => 10,
-width => 280,
-height => 180,
-style => WS_CHILD | WS_VISIBLE | 1,
-fullrowselect => 1,
-gridlines => 1,
-checkboxes => 1,
# -hottrack => 1,
);
$LV1 = $win->AddButton(-name => "LV1", -text => "Big Icons",
-left => 10, -top => 200,
);
$LV2 = $win->AddButton(-name => "LV2", -text => "Small Icons",
-left => 10, -top => 230,
);
$LV3 = $win->AddButton(-name => "LV3", -text => "List",
-left => 10, -top => 260,
);
$LV4 = $win->AddButton(-name => "LV4", -text => "Details",
-left => 10, -top => 290,
);
$width = $LV->ScaleWidth;
#$LV->InsertColumn(-index => 0, -width => $width/2, -text => "Name");
#$LV->InsertColumn(-index => 1, -subitem => 1, -width => $width/2, -te
+xt => "Description");
#
#$LV->InsertItem(-item => 0, -text => "ciao", -image => 0);
#$LV->SetItem(-item => 0, -subitem => 1, -text => "greetings");
#$LV->InsertItem(-item => 1, -text => "abracabra", -image => 1);
#$LV->SetItem(-item => 1, -subitem => 1, -text => "magic word");
#
#$LV->TextColor(hex("0000FF"));
#
#
#
sub LV1_Click {
print "BIG Icons!\n";
$LV->View(0);
}
sub LV2_Click {
print "small Icons!\n";
$LV->View(2);
}
sub LV3_Click {
print "List!\n";
$LV->View(3);
}
sub LV4_Click {
print "Details!\n";
$LV->View(1);
}
$win->lvwData_Entered->Clear();
$win->lvwData_Entered->InsertColumn ( -text=>"Tape", -width=>80);
$win->lvwData_Entered->InsertColumn ( -text=>"MFGDATE", -width=>80
+);
$win->lvwData_Entered->InsertColumn ( -text=>"Library", -width=>80
+);
$win->lvwData_Entered->InsertColumn ( -text=>"DateLoaded", -width=
+>80);
$win->Show();
$win->lvwData_Entered->InsertItem ( -item=>0, -text=>"000234D");
$win->lvwData_Entered->InsertItem ( -item=>1, -text=>"000235D");
$win->lvwData_Entered->InsertItem ( -item=>2, -text=>"000236D");
$win->lvwData_Entered->Update();
#$win->tfLoad_TapeName->SetFocus();
#print_dbg("Main()--Listview","Column must be ".$win->lvwData_Ente
+red->GetStringWidth("000000d").
# " characters wide.\n.");
#print_dbg("Main()--Listview","There are ".$win->lvwData_Entered->
+Count()." tapes in list.\n");
#print_dbg("Main()--Listview","First visible is ".$win->lvwData_En
+tered->GetFirstVisible()."\n");
#print_dbg("Main()--Listview","View-mode: ".$win->lvwData_Entered-
+>View()."\n");
#print_dbg("Main()--Listview","There are ".$win->lvwData_Entered->
+VisibleCount().
# " Viewable tapes in list.");
show:;
$win->Show();
$win->Dialog();
GUI::Show($Win32::GUI::hwnd);
|