Is that another for loop be helpful ?

----- Original Message ----- 
From: "Timothy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 28, 2002 11:35 AM
Subject: Constant Question


> I am building an array of Tk button and each button will invoke the
> same subroutine. However I need the index of the calling button to
> be sent to the subroutine. So far I have a for loop and a SWITCH that
> that works but it seems to me to be pretty poor coding:
> 
>   for ($intIndex=0; $intIndex<20; $intIndex++) {
>     SWITCH: {

        for (0..19) 
            {  if ($intIndex == $_) 
               { 
$objButton=$objFrame->Button(-background=>$BG,-borderwidth=>'1',-command=>
                 sub {&FileBrowse ($objWindow, 
$_)},height=>'1',-text=>'Browse')->pack(-side=>'top',-anchor=>'w') }
               }
               last if $intIndex == $_
            }
>     }
>     push @arrButton, $objButton;
> 

I have no perl in this computer, so can't test it.
Try if you like =)

Rgds,
Connie


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to