Hello,

I have a strange problem with my code.  After I terminate my window.  The
program runs my user defined functions again.  Why is it doing this and how
do I stop it.  I've included my code but I took everything out but the
print statements which show the function running after the I terminate the
gui window, below the code is the output.

-----------CODE-----------
# WebDeploy v2.0.0

use Win32::GUI;
use File::Copy;
use Win32::File;

print "#Before CreateWindow()\n";
CreateWindow();
print "#After CreateWindow(), Before Show()\n";
$Window->Show();
print "#After Show(), Before Dialog\n";
Win32::GUI::Dialog();
print "#After Dialog\n";
print "#Finished\n";

#=====================
sub CreateWindow {
     print "#Start of CreateWindow()\n";
     $Window = new GUI::Window(
          -name     =>   "Window",
          -text     =>   "Web Deploy v2.0.0",
          -width    =>   800,
          -height   =>   700,
          -left     =>   25,
          -top =>   25,
     );



     $CBdropdown = $Window->AddCombobox(
         -name   => "Dropdown",
         -left   => 10,
         -top    => 500,
         -width  => 250,
         -height => 100,
         -style  => WS_VISIBLE | 2 | WS_NOTIFY,
     );
     $CBdropdown->InsertItem("samples");
     $CBdropdown->InsertItem("Ops");
     $CBdropdown->InsertItem("Timesheet");

     print "#End of CreateWindow()\n";
}

#====================
sub Dropdown_Change {
     print "#Start of Dropdown_Change\n";
     my $s = $CBdropdown->SelectedItem;
     print "#Before GetFiles()\n";
     GetFiles($s);
     print "#After GetFiles(), End of Dropdown_Change\n"
}

#=====================
GetFiles($s);
#=====================
sub GetFiles {
     print "#Start of GetFiles()\n";
     print "#Before InsertListItem\n";
     InsertListItem();
     print "#After InsertListItem\n";
     print "#End of GetFiles()\n";
}

#====================
sub InsertListItem {
     print "#Start of InsertListItem\n";
     print "#End of InsertListItem\n";
}

#=====================
sub Window_Terminate {
     print "#In Window_Terminate\n";
    return -1;
}

-----------OUTPUT---------------
D:\code>webdeploy2.pl
#Before CreateWindow()
#Start of CreateWindow()
#End of CreateWindow()
#After CreateWindow(), Before Show()
#After Show(), Before Dialog
#Start of Dropdown_Change
#Before GetFiles()
#Start of GetFiles()
#Before InsertListItem
#Start of InsertListItem
#End of InsertListItem
#After InsertListItem
#End of GetFiles()
#After GetFiles(), End of Dropdown_Change
#In Window_Terminate
#After Dialog
#Finished
#Start of GetFiles()
#Before InsertListItem
#Start of InsertListItem
#End of InsertListItem
#After InsertListItem
#End of GetFiles()

D:\code>

What I did was start the program (The output goes to '#After Show(), Before
Dialog').  Then I select something from the dropdown box (output goes to '
#After GetFiles(), End of Dropdown_Change').  Then click on the 'X' to
close the window.  Now after "#Finished" shouldn't the program end and not
run my user functions again?

Please help.

Thanks,

Joe





Reply via email to