Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Help with TK writing shorter code

by alexanderp98 (Novice)
on Sep 22, 2011 at 17:25 UTC ( [id://927422]=note: print w/replies, xml ) Need Help??


in reply to Re: Help with TK writing shorter code
in thread Help with TK writing shorter code

Thanks for your help. Is there a way to identify which slot a given start button is associated with? Thanks.

Replies are listed 'Best First'.
Re^3: Help with TK writing shorter code
by zentara (Archbishop) on Sep 22, 2011 at 17:50 UTC
    The button is defined by $x, in the sub make_slot
    $goSlot[$x] = $slot->Button()
    so keep track of $x.

    What are you trying to do with the button tracking?


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
      I'm trying to figure out how to keep track of $x. I want to be able to pass a unique serial number that is associated with the start button. So, for example, if slot 1 contained serial number 01234567, I want to be able to process that serial number if slot 1's start button is pressed. I'm pretty new to perl so I'm kind of floundering here. Thanks for your help.

        You could pass the slot number to the compute call:

        $goSlot[$x] = $slot->Button( ... -command => sub { compute($x) },

        Then, in the compute sub, you can access @sernums, @partnums, etc. e.g.:

        sub compute { my( $slotnum ) = @_; print "sernum=$sernums[$slotnum], partnum=$partnums[$slotnum]\n"; }
        I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://927422]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-03-29 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found