[GRASS-dev] Re: gis.m: font selection in module panels
Moritz Lennert
mlennert at club.worldonline.be
Mon May 21 16:49:20 EDT 2007
On Mon, May 21, 2007 04:46, Michael Barton wrote:
> Moritz,
>
> For when you get up tomorrow.
>
> Try this for the entire if clause
>
> if {![info exists env(GRASS_FONT)]} {
> set fontindex -1
> } elseif {$env(GRASS_FONT) != ""} {
> set fontindex [lsearch $fontlist $env(GRASS_FONT)]
> if {$fontindex > -1} {
> $fontlb selection set $fontindex
> $fontlb see $fontindex
> }
> }
>
Doesn't work, but I'm getting closer to identifying the problem:
Going back to the original version and just erasing the second part of the
if clause, I now notice (a bit more awake than yesterday) that I still get
an error message, but not the same:
can't read "env(GRASS_FONT)": no such variable
can't read "env(GRASS_FONT)": no such variable
while executing
"lsearch $fontlist $env(GRASS_FONT)"
(procedure "Gm:DefaultFont" line 27)
invoked from within
"Gm:DefaultFont dbarscale"
(procedure "GmDtext::set_font" line 5)
invoked from within
"GmDtext::set_font 1"
("uplevel" body line 1)
invoked from within
"uplevel \#0 $cmd"
(procedure "Button::_release" line 18)
invoked from within
"Button::_release .mainframe.frame.pw1.f1.frame.sw.sf.frame.fr.fontopt1.b"
(command bound to event)
So actually the problem is not the 'if exists' clause, but it's
'$env(GRASS_FONT)'. For some reason, it seems like it does not recognize
env() as the function it is, but rather it tries to get the content of a
variable name 'env(GRASS_FONT)'. GRASS_FONT is recognized as existing,
since it passes the test 'if {[info exists env(GRASS_FONT)]}'.
I cannot reproduce this directly in tclsh, though, so I am a bit lost.
Changing the way env is declared as global at the beginning of the
function does not help either.
> I'm kind of waving a dead chicken, but maybe this syntax will work.
Chicken still just as dead.
Moritz
> Michael
>
>
> On 5/20/07 6:27 AM, "Moritz Lennert" <mlennert at club.worldonline.be> wrote:
>
>> Michael,
>>
>> Thanks for the font selection in the module panels, but I have the
>> following problem. I can select the font the first time, but when I try
>> to
>> open the font dialog a second time in the same panel, I get:
>>
>> can't read "env(GRASS_FONT)": no such variable
>> can't read "env(GRASS_FONT)": no such variable
>> while executing
>> "if {[info exists env(GRASS_FONT)] && $env(GRASS_FONT) != ""} {
>> set fontindex [lsearch $fontlist $env(GRASS_FONT)]
>> if {$fontindex > -1} {
>> ..."
>> (procedure "Gm:DefaultFont" line 26)
>> invoked from within
>> "Gm:DefaultFont dbarscale"
>> (procedure "GmBarscale::set_font" line 5)
>> invoked from within
>> "GmBarscale::set_font 1"
>> ("uplevel" body line 1)
>> invoked from within
>> "uplevel \#0 $cmd"
>> (procedure "Button::_release" line 18)
>> invoked from within
>> "Button::_release .mainframe.frame.pw1.f1.frame.sw.sf.frame.fr.color.d"
>> (command bound to event)
>>
>> Moritz
>>
>
> __________________________________________
> Michael Barton, Professor of Anthropology
> School of Human Evolution & Social Change
> Center for Social Dynamics & Complexity
> Arizona State University
>
> phone: 480-965-6213
> fax: 480-965-7671
> www: http://www.public.asu.edu/~cmbarton
>
>
>
More information about the grass-dev
mailing list