From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue Nov 10 2009 - 18:41:04 CST

Nuno,
  Rather than using the exit function to reset the state of the
plugin, it would be better to have a "clear" or "reset" button to
start a new "session" within your plugin. If you look at complex
plugins like multiseq, this is more or less what they do. You can
create and destroy sub-windows, it's only the main plugin window that
needs to stay around to avoid creating difficulties with the way it
shows up in the Extensions menu. The APBSRun plugin creates extra
windows in some cases which are subsequently destroyed, for example.

Cheers,
  John

On Wed, Nov 11, 2009 at 12:14:12AM +0000, Nuno Sousa Cerqueira wrote:
> Thanks for the reply.
> I understand what you said. But what if I want to execute a command
> each time the user clicks in the plug-in under the extension menu (for
> instance to reset the values on the plug-in window?
>
> Cheers,
>
> Nuno Sousa Cerqueira
>
> On Nov 10, 2009, at 10:33 PM, John Stone wrote:
>
> >
> >Nuno,
> > Have a look at the Tk plugin examples I've provided here:
> >http://www.ks.uiuc.edu/Research/vmd/plugins/doxygen/tcltkplugins.html#tcltkplugins
> >
> >You don't actually want to destroy your plugin's window, you only
> >want to
> >iconify it. There are a few exceptions to this (e.g. multiplot) but
> >in most
> >cases, you just want the plugin window hidden, and you don't want to
> >destroy
> >it and all of the callbacks etc that may have been registered.
> >
> >Let us know if you have more questions.
> >
> >Cheers,
> > John Stone
> > vmd_at_ks.uiuc.edu
> >
> >On Tue, Nov 10, 2009 at 10:55:24AM +0000, Nuno Sousa Cerqueira wrote:
> >> Hello,
> >> I made a Gui for vmd.
> >> The Gui is started with this :
> >> if {[winfo exists $VsLab::topGui]} {wm deiconify
> >>$VsLab::topGui ;return}
> >> toplevel $VsLab::topGui
> >> (...)
> >> I have a exit button in the Gui that does the following command:
> >> grid [ttk::button $VsLab::topGui.f2.exit -text "Exit" -command
> >>{destroy
> >> $VsLab::topGui}] -in $VsLab::topGui.f2 -padx 20 -pady 5 -sticky e
> >> However, when I click the exit button and go again to the menu
> >>where the
> >> shortcut of the extension is installed I can not longer load the
> >>Gui.
> >> I can only do it if I go to the tkconsole and write the proc that
> >> initializes the Gui.
> >> If I close the window with the X button (in the top corner of the
> >>window)
> >> I can can do it....
> >> does anyone had a similar problem....
> >> Regards , nuno
> >
> >--
> >NIH Resource for Macromolecular Modeling and Bioinformatics
> >Beckman Institute for Advanced Science and Technology
> >University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> >Email: johns_at_ks.uiuc.edu Phone: 217-244-3349
> > WWW: http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078