I am having problems closing windows

I have written a script that pulls up a window and asks for users entry

Then it pulls up a second window

My problems are that if the user cancels the first window by hitting the
close window button X at the top of the window the program doesn't end but
still pulls the second window.

The second problem is that the first window is still open on the task bar.

I could use HideWindow on the first window but that still leaves it open. I
would really like to completely kill the first window when I call the
second.

I hope this make sense

The code I am using is as follows:

use Win32::GUI; 
use strict;

###########################################################################
#set variables
#variables
my ($Frame,$title,$assetexist,$assetid);

#set font
my $font = Win32::GUI::Font->new(
        -size => 24,
                -name => "Arial", 
                );

#Enter Asset Number

$title = "Asset/Network Entry";

&FRAME;

$Frame->AddTextfield( 
        -name => "aTextField", 
        -top => 40, 
        -left => 20, 
        -height => 40, 
        -width => 300, 
        -prompt => "Enter Asset Number",
); 

#set field text
$Frame->aTextField->Text($assetid);
#set cursor on field
$Frame->aTextField->SetFocus();

$Frame->AddButton( 
        -name => "aButton", 
        -text => "OK", 
        -top => 180, 
        -left => 100, 
); 

$Frame->AddButton( 
        -name => "cancel", 
        -text => "CANCEL", 
        -top => 180, 
        -left => 200, 
); 

#display window
$Frame->Show(); 
Win32::GUI::Dialog(); 
###########################################################################


#check if asset exists in database
if ($assetexist eq "" )  {
        $title = "No Asset Found";
        &FRAME;

        $Frame->AddLabel( 
                -name => "aTextField", 
                -top => 50, 
                -left => 20, 
                -text => "Asset ID    ${assetid} Does not Exist",
        ); 
        $Frame->AddButton( 
                -name => "cancel", 
                -text => "OK", 
                -top => 180, 
                -left => 150, 
        ); 
        $Frame->Show(); 
        Win32::GUI::Dialog(); 
}


sub aFrame_Terminate { -1; } 

sub aButton_Click {
        $assetid=$Frame->aTextField->Text();
        if ($assetid ne "") {&aFrame_Terminate};
}

sub aButton1_Click { &aFrame_Terminate; }

sub cancel_Click {
        &aFrame_Terminate;
        exit;
}

sub FRAME {
        $Frame = new Win32::GUI::Window( 
                -font => $font,
                -name => "aFrame", 
                -top => 100, 
                -left => 450, 
                -width => 350, 
                -height => 250, 
                -title => "$title",
        ); 
}
__END__ 

Regards


Mike Solomon
Technical Manager
Work     01582 831125
Mobile 07941 537 172
email   [EMAIL PROTECTED]

============================================================================
======
Important: Any views or opinions expressed by the sender do not necessarily
represent those of the 3s Group. This e-mail and any attachment(s)
are intended for the above named only and may be confidential.  If you are
not
the named recipient please notify us immediately.  You must not copy or
disclose
the contents to any third party.

Internet e-mail is not a fully secure communications medium.  Please take
this into account when sending e-mail to us.
Any attachment(s) to this e-mail are believed to be free from virus, but it
is the responsibility of the recipient to make all the necessary virus
checks. 

www.3s-group.com

=========================================================================

Reply via email to