Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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

by ralfthewise (Sexton)
on Jun 21, 2001 at 22:27 UTC ( #90481=note: print w/replies, xml ) Need Help??

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

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?
  • 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.
      I'm rather new to I thought I saw somewhere that I could vote on helpful responses to queries. If so, how do I do that?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://90481]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2018-07-20 10:20 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (427 votes). Check out past polls.