Sujet : Re: How to set ttk::radiobutton -variable to an object's instance variable?
De : m.n.summerfield (at) *nospam* gmail.com (Mark Summerfield)
Groupes : comp.lang.tclDate : 11. Jul 2025, 16:21:52
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <104ra6g$1iid4$1@dont-email.me>
References : 1 2
User-Agent : Pan/0.154 (Izium; 517acf4)
On Fri, 11 Jul 2025 13:28:06 +0200, Schelte wrote:
On 11/07/2025 11:55, Mark Summerfield wrote:
Given this class:
oo::class create App {
# ...
variable ShowState
}
And this method:
oo::define App method make_controls {} {
# ...
ttk::radiobutton .controlsFrame.showFrame.asIsRadio \
-text "Show as-is" -value asis -variable ShowState
set ShowState asis
The variable given to the radio button and the instance variable
are_different_.
ttk::radiobutton .controlsFrame.showFrame.asIsRadio \
-text "Show as-is" -value asis -variable [my varname ShowState]
Schelte.
That silently didn't work.
I also tried `-variable [my variable ShowState]` and that didn't work
either.
I don't use snit so I couldn't use that approach either.
Given that Tcl 9 has the incredibly useful `callback` command
which I use all the time with Tk widgets for their `-command`
options, I'm surprised there isn't an equivalent for Tk widget
variables: or perhaps there is and I haven't found it?