----- Original Message ----- From: "Jason Archer" <[EMAIL PROTECTED]> To: "Zielfelder, Robert" <[EMAIL PROTECTED]> Cc: "Perl Beginners" <[EMAIL PROTECTED]> Sent: Tuesday, March 25, 2003 3:56 PM Subject: Re: Perl/TK problem with sub routines
> My guess would be (I am a noob also, with no experience of Tk module) is > that you are not destroying the old sub-window with each loop in the sub. > Hence each pass through the foreach loop creates a new window object wthout > destroying the old one, hence you end up with lots of windows. > > > ----- Original Message ----- > From: "Zielfelder, Robert" <[EMAIL PROTECTED]> > To: "Perl Beginners List (E-mail)" <[EMAIL PROTECTED]> > Sent: Tuesday, March 25, 2003 3:24 PM > Subject: Perl/TK problem with sub routines > > > > Greetings, > > > > I am having trouble with PERL/Tk gius and subroutines. I have a button > that > > calls a subroutine using the "command" method. The subroutine is supposed > > to get a list of selected lines from a listbox in the first window and set > > up an array variable based on this list. It is then supposed to destroy > the > > first window, and then display a new window foreach item in the array. My > > problem in that when the foreach loop runs, all of the "second" windows > > display at the same time instead of one at a time while the loop executes. > > Does anyone know what I am doing wrong? The structure of the loop seems > OK, > > if I put other commands in there they execute one at a time like I would > > expect. I'm guessing the problem lies in the usage of Tk.... > > > > > > ...subroutine called from button in "mw" window. > > > > sub pick_layers { > > my @dc_steps_list = $selected_lb->get(0, 'end'); > > $mw->destroy(); > > foreach my $dcl (@dc_steps_list) { > > > > $mw1 = MainWindow->new(); > > $mw1->minsize(500,500); > > $mw1->configure( > > -background => darkturquoise, > > -foreground => black, > > -relief => sunken, > > -cursor => hand1, > > -borderwidth => 2 > > ); > > $mw1->title("Date Code Options"); > > } > > } > > > > > > > > Best Regards, > > > > Robert Zielfelder > > .-. --.. > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]