PERL GUI USERS, I can't get image to display in TreeView. HELP
PLEASE!!
-Eric
use Win32::GUI;
$M = new Win32::GUI::Menu(
"&File" => "File",
" > E&xit" => "Exit"
);
$W = new Win32::GUI::Window (
-title => "TreeView Example",
-menu => $M,
-name => "Window",
-left => 125,
-top => 25,
-width => 550,
-height => 500,
-style => WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
);
$Bitmap = new Win32::GUI::Bitmap("$PWD\\16pixels_sq.bmp");
$IL = new Win32::GUI::ImageList(16, 16, 0, 1, 0);
$IL->Add($Bitmap,0);
$TV = $W->AddTreeView (
-name => "TV",
#-font => $SFont,
-left => 10,
-top => 50,
-width => 150,
-height => 350,
-lines => 1,
-rootlines => 1,
-buttons => 1,
-visible => 1,
-checkboxes => 0,
-imagelist => $IL,
);
# $TV->SetImageList($IL, 0); #--- 0 used for Treeviews and not 1
$TV->BackColor("16316608");
$Status = $W->AddStatusBar(
-name => "Status",
-text => " ",
-font => $SFont
);
$node = $TV->InsertItem(-text => "Hello", -indent => 1, -image => 1,
-selectedimage => 0);
$TV->InsertItem(-parent => $node, -text => "World");
$TV->InsertItem(-parent => $node, -text => "Utah");
$W->Show();
$W->BringWindowToTop();
#####################
# Event Handler
#####################
Win32::GUI::Dialog(); #-- enter event handler
##################
sub TV_NodeClick {
##################
my $node = shift;
my %nodeinfo = $TV->ItemInfo($node);
my $text = $nodeinfo{-text};
my $parent = $TV->GetParent($node);
if ($parent != 0) {
my %parentinfo = $TV->ItemInfo($parent);
my $ptext = $parentinfo{-text};
$Status->Text("parent=$parent, node=$node, ptext=$ptext,
text=$text");
$Status->Update();
} else {
$Status->Text("parent=$parent, node=$node, text=$text");
$Status->Update();
}
}
##################
sub Exit_Click {
##################
return -1; #-- stops event handler
}
######################
sub Window_Terminate {
######################
return -1; #-- stops event handler
}