Re: How to do callbacks to methods

Liste des GroupesRevenir à cl tcl 
Sujet : Re: How to do callbacks to methods
De : mark (at) *nospam* qtrac.eu (Mark Summerfield)
Groupes : comp.lang.tcl
Date : 11. Jul 2024, 09:04:56
Autres entêtes
Message-ID : <CF2dndGVPsS1DxL7nZ2dnZfqn_adnZ2d@brightview.co.uk>
References : 1
User-Agent : Pan/0.154 (Izium; 517acf4)
Sorry for the noise, I found the solution on the wiki:

#!/usr/bin/env wish9
proc ::oo::Helpers::callback {method args} {
    list [uplevel 1 {namespace which my}] $method {*}$args
}
tk appname "Test App"
oo::class create App {
    constructor {} {
        wm withdraw .
        wm title . [tk appname]
        grid [ttk::button .quitButton -text Quit -underline 0 \
              -command [callback on_quit]]
        bind . <Escape> [callback on_quit]
        bind . <Alt-q> [callback on_quit]
    }
    method on_quit {} {
        destroy .
    }
    method show {} {
        wm deiconify .
        raise .
    }
}
set application [App new]
$application show

Date Sujet#  Auteur
11 Jul 24 * How to do callbacks to methods3Mark Summerfield
11 Jul 24 +- Re: How to do callbacks to methods1Mark Summerfield
11 Jul 24 `- Re: How to do callbacks to methods1greg

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal