Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl/TK - control two windows conditionally

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
HI,

I need to create 2 dialogs.Both should start or not depending on some conditions - respectively
If none conditions are matched - I do not need any of them started,and the application to run without popping up any window.
Did not manage to achieve it with current code:

unless ( -f "$INSTPATH\\company.txt" || $company) { #only if the file does not exist
$mw = MainWindow->new;
$mw->withdraw;
$guimode = "YES";
#$mw->withdraw;
$frm1=$mw->Frame(-relief=>'groove',-borderwidth=>3,-background=>'blue')->pack(-side=>'top',-fill=>'x'); #the password part
my $compwin = $frm1->Toplevel(-width =>55,-title => 'Enter company name');
$company = '';
$compwin->Label(-text => 'Enter company name')->pack(-side=>'top');
$compwin->bind('<Return>'=>sub{&start});
$compwin->focus(-force);
my $compentry = $compwin->Entry (-width =>35,-background=>'white',-textvariable =>\$company)->pack(-side=>'left',-pady=>3);
my $submitBttn = $compwin->Button (-text => 'OK',-command =>sub{&start})->pack(-side=>'right',-pady=>3);
$compentry->focus(-force);
#$compentry->focus(-force); $dialog1->Show;
} else {
$mw = MainWindow->new;
$mw->withdraw;
$dialog2 = $mw->DialogBox (-title => 'ZIP file creation has failed !!!',-buttons => [ 'YES', 'No' ], #define the final dialog
-default_button => 'OK');
$dialog2->add ('Label', -text => 'ZIP file creation has failed !!!',-font =>'Arial 14 bold' ,-foreground => 'red')->pack;
&start;
}

MainLoop ;

.
.
.
if ($zip->read( $ZIPNAME ) != AZ_OK) {
$dialog2->Show;
}

Long live king Moshiach !
 
The second popu $dialog2 never starts.
Guess it's because the if it goes via the second "else" loop which includes $dialog2,it skips the "Mainloop" part and goes directly to "start" sub ...

Long live king Moshiach !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top