[EMAIL PROTECTED] writes:
 > > I may be missing the point here, but if you have just created the
 > > button you know it hasn't been packed yet. Why would you need to ask
 > > it?
 > 
 > The button is created inside a subroutine that is called via another button.
 > The user could click again on the first button, and then i get a second
 > button below the first one, and so on... 

Sorry, Lars, I still don't understand why you need to ask a button if
it is packed. Doesn't the following do pretty much what you describe?

--------------------------------------------------
#!/bin/env perl

use strict;
use warnings;
use Tk;

my $MW = MainWindow->new;

new_button($MW, "First button");

MainLoop;

sub new_button {
    my $top = shift;
    my $label = shift;

    my $b = $top->Button(-text => $label,
                         -command => [\&new_button, $top, "Another Button"]);
    $b->pack;
}
--------------------------------------------------

HTH

-- 
Brian Raven
/* This bit of chicanery makes a unary function followed by
a parenthesis into a function with one argument, highest precedence. */
             -- Larry Wall in toke.c from the perl source code


-----------------------------------------------------------------------
The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of 
LIFFE Holdings Plc or any of its subsidiary companies.
-----------------------------------------------------------------------

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to