in reply to (ichimunki) Re: Clearing entry boxes in a GUI?
in thread Clearing entry boxes in a GUI?

Thanks!
Another question if I may
I have five entry boxes to clear. I used your second -command structure ($Entry->delete(0,'end') and chained it into the code like thus:
$top->Button(-text=>"Save RegEdits to a File", -foreground=>"blue", -command=>sub{save()},
-command => sub { $entry1->delete( 0, 'end' )},
-command => sub { $entry1->delete( 0, 'end' )},
-command => sub { $entry3->delete( 0, 'end' )},
-command => sub { $entry4->delete( 0, 'end' )} )->pack()
But the daisy chained -commands looking at each entry didn't all work. In fact, only the first worked, and for some reason the save fxn at the beginning didn't work either. What am I doing wrong?
john
  • Comment on Re: (ichimunki) Re: Clearing entry boxes in a GUI?

Replies are listed 'Best First'.
(ichimunki) {Re} x 2: Clearing entry boxes in a GUI?
by ichimunki (Priest) on Jun 21, 2001 at 22:38 UTC
    You can only have one -command attribute per Button widget. You might try:
    -command => sub {$e1->delete(0,'end'); $e2->delete(0,'end'); ... $e5->delete(0,'end'); }
    Or better yet, instead of sub, use a reference to an actual subroutine so your button declaration isn't so messy and that way you can call the resulting sub from other places in the script if needed.
      p.s.
      I'm rather new to perlmonks.com. I thought I saw somewhere that I could vote on helpful responses to queries. If so, how do I do that?
      john