Real Perl has asked for the wisdom of the Perl Monks concerning the following question:
Most Honorables,
I am running into an interesting challenge that I hope your glowing wit will lighten. I have an Entry widget in which my user can only enter the letters DATSOU. The program allows the user to keep some default that can be loaded. When my user saves default from that widget, I pick up the textvariable (he cannot type any other letters than DATSOU)and place it in my default file (everything is fine here). When the user loads the default from the file, I read the file in an array an assign the values with the corresponding variables. However, I get this error:Thanks in advance for your precious time,#!/usr/bin/perl -w use strict; use Tk; use Tk::Entry; my @arraydefault; my $copytf; $copytf = $page2 ->Entry (-textvariable=> \$copyentry, -validate=> 'key', -validatecommand=> sub{$_[1] =~/['a','d', 't', 's', 'o', ' +u', 'A','D', 'T', 'S', 'O', 'U']/}, -invalidcommand=> sub{$page2->bell})->pack; my $loaddefaultb=>$mw->Button (-text=>'Load Defaults', -command => sub + {loaddef()})->pack; MainLoop; sub loaddef(){ open (DEFAULTIN, "<default.txt"); while(<DEFAULTIN>){ chomp; @arraydefault = split /,/; }#while $copyentry=$arraydefault[11];}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Changing the Textvariable of a restricted entry widget (TK)
by Tanktalus (Canon) on Aug 03, 2005 at 03:42 UTC | |
by pg (Canon) on Aug 03, 2005 at 04:47 UTC | |
|
Re: Changing the Textvariable of a restricted entry widget (TK)
by graff (Chancellor) on Aug 03, 2005 at 05:06 UTC |