Re: How to pass an object from inside its own method to a helper function

Liste des GroupesRevenir à cl tcl 
Sujet : Re: How to pass an object from inside its own method to a helper function
De : nospam (at) *nospam* wanadoo.nl (Schelte)
Groupes : comp.lang.tcl
Date : 11. Jul 2024, 12:12:52
Autres entêtes
Organisation : KPN B.V.
Message-ID : <nnd$51f688df$79eeaed5@f984d21cd0a14d8f>
References : 1 2
User-Agent : Mozilla Thunderbird
On 11/07/2024 12:03, Mark Summerfield wrote:
I worked out how to do it:
 proc make_file_menu {app} {
     .menu.file add command -command [list ${app}::my on_quit] \
        -label Quit -underline 0 -accelerator Ctrl+Q
}
 
Or less hacky:
proc make_file_menu {app} {
     .menu.file add command -command [list $app on_quit] \
        -label Quit -underline 0 -accelerator Ctrl+Q
}
Originally you had $app inside curly braces, which prevented it from being substituted at definition time. At execution time, the app variable was out of scope.
Schelte.

Date Sujet#  Auteur
11 Jul 24 * How to pass an object from inside its own method to a helper function5Mark Summerfield
11 Jul 24 `* Re: How to pass an object from inside its own method to a helper function4Mark Summerfield
11 Jul 24  `* Re: How to pass an object from inside its own method to a helper function3Schelte
11 Jul 24   `* Re: How to pass an object from inside its own method to a helper function2Mark Summerfield
11 Jul 24    `- Re: How to pass an object from inside its own method to a helper function1Ralf Fassel

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal