Sujet : Re: How to set ttk::radiobutton -variable to an object's instance variable?
De : emiliano (at) *nospam* example.invalid (Emiliano)
Groupes : comp.lang.tclDate : 12. Jul 2025, 00:13:59
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250711201359.603c19797681ae3976d16848@example.invalid>
References : 1 2 3 4
User-Agent : Sylpheed 3.5.1 (GTK+ 2.24.32; i686-pc-linux-gnu)
On Fri, 11 Jul 2025 21:12:08 +0200
Schelte <
nospam@wanadoo.nl> wrote:
...
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.
Adding to what Schelte correctly pointed out, these are your options:
* [my varname somevar]: This works inside TclOO objects, and works for scalar
variables, arrays and array elements.
* [namespace which -variable somevar]: This works inside TclOO objects and
namespaces. Works for scalar variables and arrays, but not for array
elements. See Tcl bug#472113 . If you need an array element, use
[namespace which -variable somearray](element).
* last but not least, [namespace current]::somevar works if somevar is
a variable in the current namespace, including the namespace of any TclOO
object, and works for scalar, array and array elements.
Regards
-- Emiliano