Re: How do I correctly access this variable?

Liste des GroupesRevenir à cl tcl 
Sujet : Re: How do I correctly access this variable?
De : user7 (at) *nospam* cmacleod.me.uk.invalid (Colin Macleod)
Groupes : comp.lang.tcl
Date : 04. Oct 2024, 09:15:02
Autres entêtes
Message-ID : <1728029702-7@cmacleod.me.uk>
References : 1
User-Agent : Newsgrouper/0.5
Luc <luc@sep.invalid> posted:

I am stumped by this:
 
array set CONTROL {
InitialStartUpDir "$env(HOME)"
}
 
puts $env(HOME)
/home/luc
 
OK.
 
Now,
 
oo::define NewTab {
constructor {} {
blah blah blah...
$newtab configure -text "$::CONTROL(InitialStartUpDir)"
}
}
 
The button label becomes "$env(HOME)" instead of /home/luc.
 
What am I doing wrong?

Variable references do not get expanded inside braces {}.
Try:
array set CONTROL "
InitialStartUpDir $env(HOME)
"

--
Colin Macleod.

Date Sujet#  Auteur
4 Oct 24 * How do I correctly access this variable?4Luc
4 Oct 24 `* Re: How do I correctly access this variable?3Colin Macleod
4 Oct 24  `* Re: How do I correctly access this variable?2Ralf Fassel
4 Oct 24   `- Re: How do I correctly access this variable?1et99

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal