tags:

views:

121

answers:

2

In Perl/Tk I have designed one interface in that I have one frame. That frame has an Entry and Text box. When I am clicking the button those Entry and Text value has to clear in the Frame. I know that I can access each object then I can clear using delete function. I need to do as like HTML form reset button functionality. How can I do these things in Perl Tk?

+1  A: 

Create a button that has access to the variables holding the values for the other widgets you want to affect. When you press the button, reset the values in those variables.

Can you show us what you have tried to far?

brian d foy
A: 

There are a ton of ways to handle this, which way will work best depends on your application and how it is structured.

In general bind a subroutine to the 'Reset' button that will clear the values of the other widgets. The actual mechanics of how you clear the widgets will vary.

Off the top of my head here are three ways to go:

  • If the widgets are bound to scalars, you could clear those scalars.
  • If the widgets are set to update an object, you could clear the values in the object.
  • You could access the widget objects directly and clear them using their built-in methods.

There are probably as many more ways to do this. Selecting which one is difficult without seeing your code to see what will fit with your coding style.

daotoad