I have a program that works fine but I want to move one function call
from one place to another: when I do so the program fails.
In particular I want to move the line marked *1* to *2*.
But when I do so, as shown below, I get this error:
proc form::show_modal form {
wm deiconify $form
raise $form
focus $form
grab set $form
after idle {focus $form} ;# *2* to here
}
On 7/29/2025 1:12 PM, Mark Summerfield wrote:
I have a program that works fine but I want to move one function call
from one place to another: when I do so the program fails.
In particular I want to move the line marked *1* to *2*.
But when I do so, as shown below, I get this error:
proc form::show_modal form {
wm deiconify $form
raise $form
focus $form
grab set $form
after idle {focus $form} ;# *2* to here
}
You are preventing/delaying the normal substitution of $form here, and
since there is no variable named "form" in scope when it fires, you get
the error.
By the way, you did not just move the line, you changed ".form" to
"$form". If you change it back, it will work.
Another way to make it work:
after idle [list focus $form]
On Tue, 29 Jul 2025 13:21:33 -0400, saito wrote:
On 7/29/2025 1:12 PM, Mark Summerfield wrote:
I have a program that works fine but I want to move one function call
from one place to another: when I do so the program fails.
In particular I want to move the line marked *1* to *2*.
But when I do so, as shown below, I get this error:
proc form::show_modal form {
wm deiconify $form
raise $form
focus $form
grab set $form
after idle {focus $form} ;# *2* to here
}
You are preventing/delaying the normal substitution of $form here, and
since there is no variable named "form" in scope when it fires, you get
the error.
By the way, you did not just move the line, you changed ".form" to
"$form". If you change it back, it will work.
Another way to make it work:
after idle [list focus $form]
Thank you that worked great. It fixed the tiny example above,
and it also worked in the application I'm developing.
Thanks too for the explanation.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,064 |
Nodes: | 10 (0 / 10) |
Uptime: | 170:41:18 |
Calls: | 13,692 |
Files: | 186,936 |
D/L today: |
90 files (19,324K bytes) |
Messages: | 2,411,676 |