Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 23 |
Nodes: | 6 (0 / 6) |
Uptime: | 46:41:26 |
Calls: | 583 |
Files: | 1,138 |
Messages: | 111,067 |
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_.
I tried these variations, all of which gave errors:
-variable [my ShowState]
-variable [my $ShowState]
-variable [self ShowState]
-variable [self $ShowState]
For now I'm using a global variable ::ShowState
but I'd really like it to be an instance variable -
if it can be done?
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_.
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.
Another way to get the fully qualified name of the variable is
[namespace which -variable ShowState]. But as that produces the same
result, it also won't work until you fix that other bug.
On 11/07/2025 17:21, Mark Summerfield wrote:
That silently didn't work.
Then you have a bug somewhere in the code you didn't show, because [my varname ShowState] correctly produces the fully qualified name of the instance variable.
Another way to get the fully qualified name of the variable is
[namespace which -variable ShowState]. But as that produces the same
result, it also won't work until you fix that other bug.
Schelte.