in reply to Re: Creating variables for each array member
in thread Creating variables for each array member

Moron,

But surely for your suggestion to have any value the Tk widgets would need an ID method, which they don't have. And having created the widgets and 'add'ed them into the container class how do you tell them apart again?

jdtoronto

  • Comment on Re^2: Creating variables for each array member

Replies are listed 'Best First'.
Re^3: Creating variables for each array member
by Moron (Curate) on Jul 25, 2006 at 13:24 UTC
    Tk::Widget and scroll down to the section headed $widget->id

    And re 'how do you tell them apart...', I've now added some comments to show that this is just an example -- I would probably use the object reference and therefore store the object reference instead of the id, but it really makes no functional difference. I notice that someone else has suggested code to store them in a hash. In a way that is what I am suggesting, but take a look at the huge reduction in coding requirements when you use a class instead of just a hash.

    -M

    Free your mind

      It's not clear to me where the "huge reduction in coding requirements" stem from compared with using a hash or an array for storing the buttons. Would you care to create two small examples showing how your object leverages the code compared with either of the other two suggestions?


      DWIM is Perl's answer to Gödel
        Given that I am saying it's a huge reduction, how can you expect me to clarify that with "two small examples" -- instead I am going to prepare a mediation that explores the hypothesis properly and update this node with a link when it's ready.

        -M

        Free your mind