I GOT IT YA'LL!! Below Code WORKS. -ERIC
use Win32::GUI;
$PWD=Win32::GetCwd(); #-- save application directory
$SFont = new Win32::GUI::Font(
-name => "Courier New",
-size => 8,
-height => -11,
-weight => 700);
$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\\13pixel_sq.bmp");
$IL = new Win32::GUI::ImageList(13, 13, 0, 1, 0);
$IL->Add($Bitmap,0);
$TV = $W->AddTreeView (
-name => "TV",
-left => 10,
-top => 50,
-width => 150,
-height => 350,
-lines => 1,
-rootlines => 1,
-buttons => 1,
-visible => 1,
-checkboxes => 0,
-imagelist => $IL,
);
$TV->BackColor("16316608");
$Status = $W->AddStatusBar(
-name => "Status",
-text => " ",
-font => $SFont
);
$node = $TV->InsertItem(-text => "Pizza", -image => 0);
#-- I don't want to show an image for children so I
#-- have to display a image that does not exist in the imagelist
#-- in order to prevent the parent image from showing for the
#-- kids. BUG?
$TV->InsertItem(-parent => $node, -text => "Small", -image => 1);
$TV->InsertItem(-parent => $node, -text => "Medium", -image => 1);
$TV->InsertItem(-parent => $node, -text => "Large", -image => 1);
$TV->InsertItem(-parent => $node, -text => "Giant", -image => 1);
$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("pnode=$parent, node=$node, ptext=$ptext,
text=$text");
$Status->Update();
} else {
$Status->Text("pnode=$parent, node=$node, text=$text");
$Status->Update();
}
}
##################
sub Exit_Click {
##################
return -1; #-- stops event handler
}
######################
sub Window_Terminate {
######################
return -1; #-- stops event handler
}
-----Original Message-----
From: Eric Hansen [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 02, 2004 3:18 PM
To: '[email protected]'
Subject: TreeView Image not showing
PERL GUI USERS, I can't get image to display in TreeView. HELP
PLEASE!!
-Eric