Re: I am failing to get a hide/show dialog to show more than once

Liste des GroupesRevenir à cl tcl 
Sujet : Re: I am failing to get a hide/show dialog to show more than once
De : mark (at) *nospam* qtrac.eu (Mark Summerfield)
Groupes : comp.lang.tcl
Date : 27. Jun 2024, 07:31:30
Autres entêtes
Message-ID : <utudnea1LKbfmuD7nZ2dnZfqnPUAAAAA@brightview.co.uk>
References : 1 2
User-Agent : Pan/0.154 (Izium; 517acf4)
On Wed, 26 Jun 2024 12:23:13 +0200, Ralf Fassel wrote:

* Mark Summerfield <mark@qtrac.eu>
| I've made a cut-down example shown below.
| If I click the Options button the Options dialog shows as it should. |
And if I click the Options dialog's Close button it is hidden.
 
No, it's not, it is destroyed (as you requested by)
 
|         ttk::button .optionsForm.closeButton -text Close \
|             -command {destroy $::test::optionsForm}
 
Part of the problem is that you only check for the existence of the
variable, but not of the window it describes.  The second time you call
test::on_options, the variable exists, but the window does not since it
was destroyed by the closeButton.
 
| # Hide/show dialog | proc test::on_options {} {
|     if {![info exists ::test::optionsForm]} {
 
I suggest to add
      || ![winfo exists $::test::optionsForm]
 
in test::on_options (and probably to unify all the different ways to
withdraw/destroy the window - Close button, WM_DELETE, Escape).
 
HTH R'

You are quite right, I made a silly copy/paste mistake.

I now use a lambda:

set on_close [lambda {} {dialog hide .optionsForm}]

and set this and the close button's command, the wm protocol for delete
window and for Esc.

I have not added the or-clause you suggested since my view is that if the
variable exists and the window doesn't it is a coding error and I want the
exception.

Thanks for your help.

Date Sujet#  Auteur
26 Jun 24 * I am failing to get a hide/show dialog to show more than once5Mark Summerfield
26 Jun 24 `* Re: I am failing to get a hide/show dialog to show more than once4Ralf Fassel
27 Jun 24  +- Re: I am failing to get a hide/show dialog to show more than once1Mark Summerfield
27 Jun 24  `* Re: I am failing to get a hide/show dialog to show more than once2Mark Summerfield
27 Jun 24   `- Re: I am failing to get a hide/show dialog to show more than once1Ralf Fassel

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal