Tanalis has asked for the wisdom of the Perl Monks concerning the following question:

Heys all,

I have created a hash containing a set of textvariables for a series of entry widgets.
Data can be placed into these just fine at first; the script can extract the data happily and work with it.
However, when it comes to updating the data in the hash, the new data does not get displayed onscreen. Also, any changes to data in the entry boxes after this point are then not placed into the array.

I assume I have some referencing problems somewhere ... but I can't figure out where. Any suggestions would be helpful .. :) The objects array is global.

My code to create each entry box is as follows:

$searchFrame -> LabEntry( -label => 'Search Phrase:' -width => 5, -labelPack => [qw/-side left/], -textvariable => \${$objects{search}} )->pack( -side => 'left' );

and the line to update it:

$objects{search} = \$data[$j];

Thanks
--Foxcub

Replies are listed 'Best First'.
Re: Hashes of Tk Entry Widget Textvariables
by grummerX (Pilgrim) on Aug 22, 2002 at 09:36 UTC
    Try changing the reference in your textvariable:
    -textvariable => \$objects{search}
    Be sure to use strict. You should have received a warning along the lines of:
    Can't use string ("FOO") as a SCALAR ref while 
    "strict refs" in use at foo.pl line 17.
    

    -- grummerX

      That's solved it, thanks.
      I was using strict - strange it didn't pick up on it.

      --Foxcub.

Hashes of Tk Entry Widget Textvariables
by Tanalis (Curate) on Aug 22, 2002 at 09:08 UTC
    I do, of course, mean hash, not array, in the above .. *grin*.

    --Foxcub.