in reply to Re: Tk question
in thread Tk question
Then I have a number of subroutines where $t is used again. These subroutines are bound to buttons whichmy $f = $mw->Frame->pack(-side => 'top', -fill => 'x'); my $t = $mw->Scrolled("Text",-font=>"{arial} 12 {bold}")->pack(-side = +> 'bottom', -fill => 'both', -expand => 1);
In the sub &tged, the get stmt should read characters within the text widget defined initially using $t.If I use$f->Button(-text => "Display", -command =>\&tged)->pack(-side => 'righ +t'); sub tged { @chars=$t->get('sel.first','sel.last'); #print "\nSelected word:"; #print @chars; } 1;
I'm not sure where we should use "my", and where we should not.Turning on use strict gives no message about $t.my $t = $mw->Scrolled("Text",-font=>"{arial} 12 {bold}")->pack(-side = +> 'bottom', -fill => 'both', -expand => 1); sub replace1{ . . $t->insert('sel.first',"$chosen1"); . . } 1; sub replace2{ . . $t->insert('sel.first',"$chosen2"); . . } 1; sub replace3{ . . $t->insert('sel.first',"$chosen3"); . . } 1; sub addit{ . . @addword=$t->get('sel.first','sel.last'); . . } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Tk question
by benn (Vicar) on Sep 10, 2003 at 09:49 UTC | |
by PhilHibbs (Hermit) on Sep 10, 2003 at 10:35 UTC | |
by benn (Vicar) on Sep 10, 2003 at 11:04 UTC | |
by perl_seeker (Scribe) on Sep 15, 2003 at 09:05 UTC | |
by perl_seeker (Scribe) on Sep 22, 2003 at 11:25 UTC | |
by Anonymous Monk on Sep 10, 2003 at 10:47 UTC |